Status update from Node-red to Home Assistant

Hi.

I am trying to move my setup from openhab to Home assistant and need some help.

My smart home consists of lights, relays sensors and panels from HDL buspro this is not supported by Hassio but plan on using nodered with pallet “node-red-contrib-hdlbus” as the interface. This is the way i have done it in openhab aswell.

Have set up an odroid n2+ with Hassio and installed nodered. I am able to control the light from Home assistant dashboard using current flow:

[{"id":"9394a95.faeb558","type":"server-state-changed","z":"b8ee1576.1ee0f8","name":"","server":"2d0671b6.920f2e","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.61_1_tv_room_downlights_1","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":240,"y":180,"wires":[["20d6f401.3ec4fc","c91fca2e.b48e98"]]},{"id":"20d6f401.3ec4fc","type":"debug","z":"b8ee1576.1ee0f8","name":"Command From Hassio","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":550,"y":280,"wires":[]},{"id":"b269a5db.4458d8","type":"comment","z":"b8ee1576.1ee0f8","name":"Output Light status from Hassio to HDL","info":"","x":190,"y":120,"wires":[]},{"id":"91d31ead.aadd1","type":"function","z":"b8ee1576.1ee0f8","name":"Change payload to HDL format","func":"var dim_level = Number(msg.data.new_state.attributes.brightness);\n\nmsg.payload =  {\n        level: dim_level\n} \n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":990,"y":160,"wires":[["d5341d35.e8f9f","df8adaec.e46528"]]},{"id":"df8adaec.e46528","type":"hdl-channel-out","z":"b8ee1576.1ee0f8","controller":"6e986e87.b7a2a","name":"61.2","address":"1.61","channel":"2","level":"","x":1250,"y":180,"wires":[]},{"id":"d5341d35.e8f9f","type":"debug","z":"b8ee1576.1ee0f8","name":"Command To HDL","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1250,"y":280,"wires":[]},{"id":"86d23fe7.89561","type":"range","z":"b8ee1576.1ee0f8","minin":"0","maxin":"255","minout":"0","maxout":"100","action":"scale","round":true,"property":"data.new_state.attributes.brightness","name":"Scale from 0-255 to 0-100","x":730,"y":160,"wires":[["91d31ead.aadd1"]]},{"id":"c91fca2e.b48e98","type":"switch","z":"b8ee1576.1ee0f8","name":"On / Off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":520,"y":180,"wires":[["86d23fe7.89561"],["1e0f0e66.ab1a72"]]},{"id":"1e0f0e66.ab1a72","type":"function","z":"b8ee1576.1ee0f8","name":"Change payload to HDL format","func":"msg.payload =  {\n        level: 0\n} \n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":870,"y":220,"wires":[["df8adaec.e46528","d5341d35.e8f9f"]]},{"id":"2d0671b6.920f2e","type":"server","name":"Home Assistant","version":1,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"6e986e87.b7a2a","type":"hdl-controller","host":"192.168.10.250","port":"6000","subnetid":"1","deviceid":"99","broadcast":false,"daliId":"92"}]

But when the lights are changed from a wall switch etc i am not able to update the status in Hassio.

Have tried a few things but my current setup is that i update Hassio entity with the hass-post(Pallet node-red-contrib-hass).

[{"id":"6abb3d07.77e144","type":"hass-post","z":"b8ee1576.1ee0f8","endpoint":"eb36774b.310148","entityid":"light.61_1_tv_room_downlights_1","name":"Status to Hassio","x":520,"y":440,"wires":[]},{"id":"a9978ce8.5d398","type":"change","z":"b8ee1576.1ee0f8","name":"Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"state\":\"off\",\"attributes\":{\"supported_color_modes\":\"brightness\",\"friendly_name\":\"TV Spots\",\"supported_features\":1}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":440,"wires":[["6abb3d07.77e144"]]},{"id":"1d0a93bd.2f7d3c","type":"inject","z":"b8ee1576.1ee0f8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":440,"wires":[["a9978ce8.5d398"]]},{"id":"6a7fb65.6ed4f48","type":"change","z":"b8ee1576.1ee0f8","name":"On 100%","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"state\":\"on\",\"attributes\":{\"supported_color_modes\":\"brightness\",\"color_mode\":\"brightness\",\"brightness\":\"255\",\"friendly_name\":\"TV Spots\",\"supported_features\":\"1\"}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":500,"wires":[["6abb3d07.77e144"]]},{"id":"596243d.70ec3bc","type":"inject","z":"b8ee1576.1ee0f8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":500,"wires":[["6a7fb65.6ed4f48"]]},{"id":"d683a8a9.a0d7b8","type":"comment","z":"b8ee1576.1ee0f8","name":"Send status update to Home assistant","info":"","x":190,"y":380,"wires":[]},{"id":"eb36774b.310148","type":"hass-config","host":"http://localhost","port":"8123"}]

I see under Developer Tools that the entity changes but on the Dashboard nothing changes. If i refresh the light goes away and i have to toggle it from developer tools for it to return. Also the light changes state witch it should not (i only want to change status and not trigger the switch.)

What am i doing wrong? Is there a other way of changing dashboard status from nodered to reflect actual status?

Btw here is my Configuration.yaml file:


# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate
# Lights
light:
  - platform: template
    lights:
      61_1_tv_room_downlights_1:
        friendly_name: "TV Spots"
        unique_id: light 61.1
        turn_on:

        turn_off:

        set_level:
 
#Splitting
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml