zachowj / hass-node-red

Companion Component for node-red-contrib-home-assistant-websocket to help integrate Node-RED with Home Assistant Core
MIT License
460 stars 182 forks source link

Does not seem to work with modern home assistant #47

Closed ReDetection closed 3 years ago

ReDetection commented 3 years ago

Describe the bug

I recently updated Home Assistant to the modern version 2020.12.2 and unfortunately Node-Red companion integration stopped working, so my custom NodeRed entity went unavailable. Previous working version was 0.113.something

Versions of the custom_component

hass-node-red custom_component: latest master (739619e) home assistant core: 2020.12.2

Debug log

I tried this logging config, no nodered/node-red occurrences appeared in logs :(

logger:
  default: info
  logs:
    custom_components.nodered: debug
curitsreno commented 3 years ago

I second the issue. I have went through the install and cannot add the node red integration. It's missing from the list of available integrations to choose from.

2020.12.2 HA installed on Debian OS running on a mac mini.

zachowj commented 3 years ago

@curitsreno read this thread and see if the solution at the bottom fixes it for you https://github.com/zachowj/hass-node-red/issues/45

curitsreno commented 3 years ago

@curitsreno read this thread and see if the solution at the bottom fixes it for you #45

That fixed my problem, thanks a million

zachowj commented 3 years ago

@ReDetection Try these and see if you see a version number and if it creates, updates, and then removes the sensor.

[{"id":"54a57a72.9d3464","type":"ha-api","z":"f61766ce.f85398","name":"","server":"","debugenabled":false,"protocol":"websocket","method":"get","path":"","data":"{\"type\": \"nodered/version\"}","dataType":"json","location":"payload","locationType":"msg","responseType":"json","x":466,"y":1584,"wires":[["3a083415.173fec"]]},{"id":"6485f27a.4667cc","type":"inject","z":"f61766ce.f85398","name":"Get Version","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":278,"y":1584,"wires":[["54a57a72.9d3464"]]},{"id":"3a083415.173fec","type":"debug","z":"f61766ce.f85398","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":694,"y":1584,"wires":[]},{"id":"46e2f431.97572c","type":"inject","z":"f61766ce.f85398","name":"Create Test Sensor","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":298,"y":1632,"wires":[["96c689d4.c22898"]]},{"id":"96c689d4.c22898","type":"ha-api","z":"f61766ce.f85398","name":"","server":"","debugenabled":false,"protocol":"websocket","method":"get","path":"","data":"{\"type\":\"nodered/discovery\",\"component\":\"sensor\",\"server_id\":\"server\",\"node_id\":\"nr_test_sensor\",\"config\":{\"name\":\"Node-RED Test Sensor\"}}","dataType":"json","location":"payload","locationType":"msg","responseType":"json","x":466,"y":1632,"wires":[["83ed1aa8.0e31c8"]]},{"id":"83ed1aa8.0e31c8","type":"debug","z":"f61766ce.f85398","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":692,"y":1632,"wires":[]},{"id":"f3d973cd.f1faa","type":"inject","z":"f61766ce.f85398","name":"Set sensor state 123","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"123","payloadType":"num","x":298,"y":1680,"wires":[["1b6fe452.cf9e1c"]]},{"id":"c0430961.2e6d48","type":"inject","z":"f61766ce.f85398","name":"Set sensor state abc","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"abc","payloadType":"str","x":298,"y":1728,"wires":[["1b6fe452.cf9e1c"]]},{"id":"1b6fe452.cf9e1c","type":"ha-api","z":"f61766ce.f85398","name":"","server":"","debugenabled":false,"protocol":"websocket","method":"get","path":"","data":"{\t   \"type\": \"nodered/entity\",\t   \"server_id\": \"server\",\t   \"node_id\": \"nr_test_sensor\",\t   \"state\": payload\t}","dataType":"jsonata","location":"payload","locationType":"msg","responseType":"json","x":466,"y":1680,"wires":[["6bfc8b62.341af4"]]},{"id":"6bfc8b62.341af4","type":"debug","z":"f61766ce.f85398","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":694,"y":1680,"wires":[]},{"id":"74085209.c2027c","type":"inject","z":"f61766ce.f85398","name":"Remove Test Sensor","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":298,"y":1776,"wires":[["d27a319b.4b53f"]]},{"id":"d27a319b.4b53f","type":"ha-api","z":"f61766ce.f85398","name":"","server":"","debugenabled":false,"protocol":"websocket","method":"get","path":"","data":"{\"type\":\"nodered/discovery\",\"component\":\"sensor\",\"server_id\":\"server\",\"node_id\":\"nr_test_sensor\",\"remove\":true}","dataType":"json","location":"payload","locationType":"msg","responseType":"json","x":466,"y":1776,"wires":[["3ad0333a.09370c"]]},{"id":"3ad0333a.09370c","type":"debug","z":"f61766ce.f85398","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":692,"y":1776,"wires":[]}]
ReDetection commented 3 years ago

Some more information:

  1. once I updated HA to 2020.12.2, Node-Red was still on the list of integrations, but entity went unavailable. Device was in the list too, but it had some icon on the very right with alt text like "Restored" or something like this, I don't remember exactly
  2. I tried to update Node-Red integration to the latest master – no effect
  3. I tried to remove and add Node-Red integration again and failed – it doesn't appear in the list of integrations

So at the moment my situation changed a bit.

@zachowj with current setup Node-Red gives me API error message – that's a pity I could not check your flow before I removed Node-Red integration :(

2021-01-04 08:00:24 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [2920653032] Received invalid command: nodered/version
2021-01-04 08:00:59 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [2920653032] Received invalid command: nodered/discovery
2021-01-04 08:01:01 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [2920653032] Received invalid command: nodered/entity
2021-01-04 08:01:05 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [2920653032] Received invalid command: nodered/entity
2021-01-04 08:01:06 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [2920653032] Received invalid command: nodered/discovery

HA restart / Browser window refresh does not help

ReDetection commented 3 years ago

OK after some time I was able to resolve this: instead of manual installation I installed HACS and proceeded to install Node-Red integration from there. Now it is working, however I find it very strange that manual installation is no longer supported and does not work. Thanks