Override payload not working in current state node

I have no clue why the following flow in not working as I expect:

  • Node “current state light commode” is set to override payload
  • however in debug node 1, I get the zwave object

{"event_type":"zwave.scene_activated","topic":"zwave.homeseer_hswd100_wall_dimmer","payload":"ready","_msgid":"f1e8d872.a6e1d8","data":{"last_updated":"2018-06-24T20:07:27.607208+00:00","state":"ready","entity_id":"zwave.homeseer_hswd100_wall_dimmer","attributes":{"receivedUnsolicited":32,"node_id":3,"receivedDups":0,"averageRequestRTT":23,"receivedCnt":78,"sentFailed":0,"is_info_received":true,"is_ready":true,"query_stage":"Complete","sentTS":"2018-06-24 16:07:27:466 ","is_failed":false,"node_name":"HomeSeer HS-WD100+ Wall Dimmer","lastRequestRTT":23,"product_name":"HS-WD100+ Wall Dimmer","sentCnt":62,"lastResponseRTT":35,"retries":0,"averageResponseRTT":35,"capabilities":["listening","routing","beaming"],"manufacturer_name":"HomeSeer","receivedTS":"2018-06-24 16:07:27:501 ","is_awake":true,"neighbors":[1,2],"max_baud_rate":40000,"is_zwave_plus":true,"friendly_name":"HomeSeer HS-WD100+ Wall Dimmer"},"last_changed":"2018-06-24T14:42:46.334277+00:00"}}

  • if i try to inject directly, debug is fine.

{"_msgid":"9ca5e2aa.2bdd7","topic":"light.commode","payload":"off","data":{"last_updated":"2018-06-24T22:02:26.905698+00:00","state":"off","entity_id":"light.commode","attributes":{"max_mireds":400,"min_mireds":111,"friendly_name":"Commode","supported_features":55},"last_changed":"2018-06-24T22:02:26.905698+00:00"}}

I really don’t get it as I’m using other similar kind of flows (but not zwave) without any issue.

This is expected behavior. I wish it worked like that. As for now you will have pass in input the entity_id you want to get the state for or delete the entity_id before goes into input using change or function.

1 Like

Thank you for this info.
So, what is the point of the “override payload” option in the node? In which case can you use it?

I was able to erase the payload with a “function” node and now my flow is working well.
However I did not find how to use the “inputs” field from “current state” node. Whatever I tried to pass, it didn’t work.

Continuing on this, I have now a case where the payload is replaced which is the reverse of the above case:


Not working, “Motion Bedroom” payload is replaced by “PIR Allowed?”. Which is the exact reverse result vs my first post (payload was not replaced).

Is there something I’m missing?

Can you export to json the flow and paste it here? Don’t forget to sanitize the password and url

I got it to work like this:

But I don’t really understand why 2 different behaviors. I should be able to redo the first version tomorrow.

did it work, @e_jp?

no. From what I tested, any “state” node will just override the complete message, whatever options you choose. This is making rules much more complicated then it should be, imho.

1 Like

I’m having the same problem with my current state node, where I have specified not to override topic or override payload.

I have made a simplified version that I have been using for testing. I have yet to find away around current state from payload topic or payload.

Blockquote[{“id”:“23f131f0.ca7d7e”,“type”:“function”,“z”:“42b2c2fe.970adc”,“name”:“Generate Announcement Message”,“func”:“var TravelStatus = msg.payload.service;\nvar User = msg.payload.data.entity_id.split(".")[1].split("_")[0];\n\nif (TravelStatus == ‘turn_on’)\n{\n msg = {payload: {data: {message: User + " has arrived"}}}\n}\nelse if (TravelStatus == ‘turn_off’)\n{\n msg = {payload: {data: {message: User + " has left"}}}\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“x”:400,“y”:540,“wires”:[[“808301a1.3fb4b”,“ea1a8582.6a2b18”]]},{“id”:“808301a1.3fb4b”,“type”:“api-current-state”,“z”:“42b2c2fe.970adc”,“name”:“Check Home Occupied”,“server”:“18d6677a.f1b479”,“halt_if”:“”,“override_topic”:false,“override_payload”:false,“entity_id”:“input_boolean.home_occupied”,“x”:690,“y”:540,“wires”:[[“bf7cdbc8.4d7098”,“67327fa6.17782”]]},{“id”:“d8b88501.8489f8”,“type”:“inject”,“z”:“42b2c2fe.970adc”,“name”:“”,“topic”:“”,“payload”:“{"service":"turn_on","data":{"entity_id":"input_boolean.shelby_home"}}”,“payloadType”:“json”,“repeat”:“”,“crontab”:“”,“once”:false,“onceDelay”:0.1,“x”:170,“y”:540,“wires”:[[“23f131f0.ca7d7e”]]},{“id”:“ea1a8582.6a2b18”,“type”:“debug”,“z”:“42b2c2fe.970adc”,“name”:“”,“active”:true,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“true”,“x”:630,“y”:600,“wires”:},{“id”:“bf7cdbc8.4d7098”,“type”:“debug”,“z”:“42b2c2fe.970adc”,“name”:“”,“active”:true,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“true”,“x”:890,“y”:600,“wires”:},{“id”:“67327fa6.17782”,“type”:“api-call-service”,“z”:“42b2c2fe.970adc”,“name”:“Google Home Basement Announcement”,“server”:“18d6677a.f1b479”,“service_domain”:“tts”,“service”:“google_say”,“data”:“{ "entity_id":"media_player.basement_speaker"}”,“mergecontext”:“”,“x”:1000,“y”:540,“wires”:[]},{“id”:“18d6677a.f1b479”,“type”:“server”,“z”:“”,“name”:“Home Assistant”,“url”:“http://hassio/homeassistant",“pass”:"”}]

There’s a fix for this, but it hasn’t been merged. If you edit nodes/api_current-state/api_current-state.js with the changes from the link below, it’ll fix it.

https://github.com/AYapejian/node-red-contrib-home-assistant/pull/78/commits/34dffd59fc7eb3b3ff84e5f9821e5a36177f6113

2 Likes

How can I edit this file on my hass.io/HassOS installation on raspberry pi?
Thanks!

I ended up installing Portainer, then changing the file by accessing the console of the Node-Red docker container. Then I pushed the changes to the docker image, and then turned off auto update on the addon.

1 Like

I tried this fix but saw no difference in behavior. May be I did it wrong: I updated the js file and restarted node-red service.

Did you commit the changes to the docker image? If not, once you restart the change reverts back. I actually stopped doing it this way and switched to the websocket fork. Just update the config window with whats below.

"npm_packages": [
    "git+https://github.com/zachowj/node-red-contrib-home-assistant-websocket"
  ],
  "init_commands": [
    "npm uninstall node-red-contrib-home-assistant"
  ]

I’m using HA in pyton virtual env.

In the following flow

I should get the current state of the last node (entity ID: light.lampe_christine), however debug message does not show that:

{"event_type":"zwave.scene_activated","topic":"zwave.homeseer_hswd100_wall_dimmer","payload":"ready","_msgid":"c67050a1.7b034","data":{"entity_id":"zwave.homeseer_hswd100_wall_dimmer","attributes":{"is_zwave_plus":true,"is_awake":true,"neighbors":[8,1,2,6,7],"sentTS":"2018-10-28 14:03:46:459 ","friendly_name":"HomeSeer HS-WD100+ Wall Dimmer","capabilities":["zwave_plus","listening","routing","beaming"],"node_id":3,"query_stage":"Complete","is_failed":false,"is_ready":true,"receivedDups":4,"manufacturer_name":"HomeSeer","node_name":"HomeSeer HS-WD100+ Wall Dimmer","lastRequestRTT":480,"product_name":"HS-WD100+ Wall Dimmer","lastResponseRTT":482,"retries":0,"receivedTS":"2018-10-28 14:05:30:797 ","sentFailed":0,"averageRequestRTT":252,"receivedCnt":100,"sentCnt":99,"receivedUnsolicited":29,"max_baud_rate":40000,"is_info_received":true,"averageResponseRTT":258},"state":"ready","context":{"id":"3ea03dff09ac471ebaedb0b8072e0e01","user_id":null},"last_changed":"2018-10-27T21:06:06.343360+00:00","last_updated":"2018-10-28T18:05:30.912652+00:00"}}

flow.xml (1,9 Ko)

I also had the problem with current state node changing the message payload.
My solution was to set the State Location and Entity Location to None, now all the previous data is coming through while being directed by the If State.

1 Like