hassio-addons/addon-node-red

Trigger State Node - errors with enable/disable #639

aegjoyce posted onGitHub

Problem/Motivation

Using msg.payload to enable/disable trigger state nodes results in the following error registering in the HA logs:

Logger: homeassistant.components.websocket_api.http.connection.2815852632
Source: components/websocket_api/connection.py:84 
Integration: Home Assistant WebSocket API (documentation, issues) 
First occurred: 12:30:26 (4 occurrences) 
Last logged: 12:33:02

Received invalid command: nodered/entity

Function of the trigger state node and subsequent flows works as expected; this is purely an error-logging issue (I think)

Expected behavior

For no error to be logged.

Actual behavior

The above error is recorded on each enable/disable instance.

Steps to reproduce

Here is an example flow that causes the error:

<img width="1059" alt="Screenshot 2020-07-31 at 12 39 45" src="https://user-images.githubusercontent.com/47081267/89031754-04743300-d32b-11ea-9b6b-c7441a8af2b6.png">

Code for this flow:

[{"id":"a87b252.4cccad8","type":"tab","label":"Away Mode","disabled":false,"info":""},{"id":"66eb5e97.c788d8","type":"status","z":"a87b252.4cccad8","name":"","scope":["1d6ce23c.b113ee"],"x":100,"y":80,"wires":[["e3063a3d.06c36"]]},{"id":"e3063a3d.06c36","type":"switch","z":"a87b252.4cccad8","name":"","property":"status.text","propertyType":"msg","rules":[{"t":"eq","v":"node-red:common.status.connected","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":90,"y":120,"wires":[["b165fa6d.3e37"]]},{"id":"b165fa6d.3e37","type":"delay","z":"a87b252.4cccad8","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":100,"y":160,"wires":[["331fce35.14cf62"]]},{"id":"331fce35.14cf62","type":"api-current-state","z":"a87b252.4cccad8","name":"","server":"c4920a33.918dc8","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"input_boolean.away_mode","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":200,"y":200,"wires":[["a3d14021.2c616"],[]]},{"id":"1d6ce23c.b113ee","type":"trigger-state","z":"a87b252.4cccad8","name":"","server":"c4920a33.918dc8","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"input_boolean.away_mode","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":200,"y":240,"wires":[["a3d14021.2c616"],[]]},{"id":"a3d14021.2c616","type":"switch","z":"a87b252.4cccad8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":430,"y":220,"wires":[["4dfd1cc7.d0318c"],["6e69096e.5e6fa"]]},{"id":"4dfd1cc7.d0318c","type":"change","z":"a87b252.4cccad8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"enable","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":160,"y":400,"wires":[["1bc32639.4c744a","7e7e13e7.e549d4"]]},{"id":"6e69096e.5e6fa","type":"change","z":"a87b252.4cccad8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"disable","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":160,"y":480,"wires":[["1bc32639.4c744a","7e7e13e7.e549d4"]]},{"id":"1bc32639.4c744a","type":"trigger-state","z":"a87b252.4cccad8","name":"","server":"c4920a33.918dc8","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"sun.sun","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"iur8h0kehyq","targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"below_horizon"},{"id":"jpf0rc9rqic","targetType":"this_entity","targetValue":"","propertyType":"previous_state","propertyValue":"old_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"above_horizon"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":420,"y":400,"wires":[["a0c1ad86.d9b03"],[]]},{"id":"7e7e13e7.e549d4","type":"trigger-state","z":"a87b252.4cccad8","name":"","server":"c4920a33.918dc8","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"sensor.time","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"mx83dng3bt","targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"21:30"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":430,"y":480,"wires":[["f678e5ce.eaefe"],[]]},{"id":"64840679.3e5d9","type":"api-call-service","z":"a87b252.4cccad8","name":"","server":"c4920a33.918dc8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.living_room_ceiling","data":"{ \"brightness_pct\": \"100\" }","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":910,"y":400,"wires":[[]]},{"id":"f678e5ce.eaefe","type":"delay","z":"a87b252.4cccad8","name":"","pauseType":"random","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"0","randomLast":"30","randomUnits":"minutes","drop":false,"x":620,"y":480,"wires":[["a51b06d5.07381","d1d769f9.a7caa8"]]},{"id":"1fd9eb1a.50d4ed","type":"api-call-service","z":"a87b252.4cccad8","name":"","server":"c4920a33.918dc8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bedroom_light","data":"{ \"brightness_pct\": \"100\" }","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1110,"y":480,"wires":[[]]},{"id":"d1d769f9.a7caa8","type":"delay","z":"a87b252.4cccad8","name":"","pauseType":"random","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"15","randomLast":"45","randomUnits":"minutes","drop":false,"x":620,"y":580,"wires":[["2a62481e.dd85e","c68ed160.a87b98"]]},{"id":"de952e28.8803f","type":"api-call-service","z":"a87b252.4cccad8","name":"","server":"c4920a33.918dc8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.living_room_ceiling","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1110,"y":580,"wires":[[]]},{"id":"a0c1ad86.d9b03","type":"api-current-state","z":"a87b252.4cccad8","name":"","server":"c4920a33.918dc8","version":1,"outputs":2,"halt_if":"home","halt_if_type":"str","halt_if_compare":"is_not","override_topic":false,"entity_id":"group.all_persons","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":670,"y":400,"wires":[["64840679.3e5d9"],[]]},{"id":"a51b06d5.07381","type":"api-current-state","z":"a87b252.4cccad8","name":"","server":"c4920a33.918dc8","version":1,"outputs":2,"halt_if":"home","halt_if_type":"str","halt_if_compare":"is_not","override_topic":false,"entity_id":"group.all_persons","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":870,"y":480,"wires":[["1fd9eb1a.50d4ed"],[]]},{"id":"2a62481e.dd85e","type":"api-current-state","z":"a87b252.4cccad8","name":"","server":"c4920a33.918dc8","version":1,"outputs":2,"halt_if":"home","halt_if_type":"str","halt_if_compare":"is_not","override_topic":false,"entity_id":"group.all_persons","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":870,"y":580,"wires":[["de952e28.8803f"],[]]},{"id":"c68ed160.a87b98","type":"delay","z":"a87b252.4cccad8","name":"","pauseType":"random","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"15","randomLast":"45","randomUnits":"minutes","drop":false,"x":620,"y":680,"wires":[["fb021959.29288"]]},{"id":"24677042.349b78","type":"api-call-service","z":"a87b252.4cccad8","name":"","server":"c4920a33.918dc8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.bedroom_light","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1110,"y":680,"wires":[[]]},{"id":"fb021959.29288","type":"api-current-state","z":"a87b252.4cccad8","name":"","server":"c4920a33.918dc8","version":1,"outputs":2,"halt_if":"home","halt_if_type":"str","halt_if_compare":"is_not","override_topic":false,"entity_id":"group.all_persons","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":870,"y":680,"wires":[["24677042.349b78"],[]]},{"id":"c4920a33.918dc8","type":"server","z":"","name":"Home Assistant","addon":true}]

An input_boolean toggles this automation on/off and is checked at startup. If on it sends 'enable' in msg.payload to the trigger-state nodes, or 'disable' if off. Each time this happens, the above error is recorded. Deleting everything after the trigger-state node does not fix the issue; deleting everything after AND the trigger-state node fixes the issue.

Running HassOS 4.11 on an rPi 4, HA version 0.113.2, nodeRed version 7.0.0

Proposed changes

Investigation into what may be triggering this error, or removal of this warning


:wave: Thanks for opening your first issue here! If you're reporting a :bug: bug, please make sure you include steps to reproduce it. Also, logs, error messages and information about your hardware might be useful.

posted by addons-assistant[bot] over 4 years ago

Try restarting the Node-RED add-on.

posted by bonanitech over 4 years ago

Try restarting the Node-RED add-on.

This doesn’t fix it sadly.

posted by aegjoyce over 4 years ago

Do you have an entity node anywhere in your flows? I had a similar issue when I started using it.

<img width="131" alt="Screen Shot 2020-07-31 at 10 01 16 AM" src="https://user-images.githubusercontent.com/29807944/89042475-ffa48480-d314-11ea-8402-24a794c16e96.png">

posted by bonanitech over 4 years ago

Do you have an entity node anywhere in your flows? I had a similar issue when I started using it.

<img alt="Screen Shot 2020-07-31 at 10 01 16 AM" width="131" src="https://user-images.githubusercontent.com/29807944/89042475-ffa48480-d314-11ea-8402-24a794c16e96.png">

Nope - not using any of these nodes in any of my flows.

posted by aegjoyce over 4 years ago

Then I think you should open an issue here.

posted by bonanitech over 4 years ago
posted by aegjoyce over 4 years ago

I think this issue can be closed now.

posted by bonanitech over 4 years ago

Fund this Issue

$0.00
Funded

Pull requests