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

Philips Hue tap switch nodes generate uncaught exceptions in Node-RED #89

Closed isaac-the-newt closed 2 years ago

isaac-the-newt commented 2 years ago

The problem

I have two HUE tap switches and a HUE smart button switch as input nodes. These are not configured with the HUE application (on IOS and that executes in the HUE Bridge) and are used only in Node-RED. They stopped working a few days ago. The Node-RED log file shows that activation of any switch on either of the two tap switches generates an uncaught exception error ... 6 Dec 13:22:28 - [red] Uncaught Exception: 6 Dec 13:22:28 - [error] ReferenceError: sensor is not defined and Node-RED restarts. The smart button works fine. I've reset the HUE Bridge API key and rejoined it into Node-RED with no joy. I've also deleted and then rejoined the tap switches from the HUE system with no joy. I've also deleted all tap switch nodes from all flows (leaving just the smart button, the bridge and the light nodes) and the error still occurs.

HUE version (reported from IOS app) 3.48.0 (11197) The HUE bridge was last updated 1 Nov 2021 to SW version 194808600 All other HUE items (lights, dimmer switches, etc) are at the current firmware release. The Node-RED version is 10.2.0 The balance of Node-RED flows are working fine. Home Assistant is a core with supervisor VM instance running inside unRAID application and file server. This configuration has been stable for more than 12 months.

What version of Home Assistant Core has the issue?

core-2021.11.5

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Philips Hue with Node-RED

Anything in the logs that might be useful for us?

Node-RED log 6 Dec 13:58:05 - [red] Uncaught Exception: 6 Dec 13:58:05 - [error] ReferenceError: sensor is not defined at EventEmitter. (/config/node-red/node_modules/node-red-contrib-huemagic/huemagic/hue-bridge.js:161:38) at EventEmitter.emit (node:events:390:28) at HueBridge.emitUpdates (/config/node-red/node_modules/node-red-contrib-huemagic/huemagic/hue-bridge-config.js:216:18) at /config/node-red/node_modules/node-red-contrib-huemagic/huemagic/hue-bridge-config.js:41:11 at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) [13:58:06] INFO: Starting Node-RED...

start node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js" 2021/12/06 13:58:07 [error] 547#547: *744 connect() failed (111: Connection refused) while connecting to upstream, client: 172.30.32.2, server: a0d7b954-nodered, request: "GET /comms HTTP/1.1", upstream: "http://127.0.0.1:46836/comms", host: "192.168.0.100:8123" 6 Dec 13:58:08 - [info] Welcome to Node-RED

6 Dec 13:58:08 - [info] Node-RED version: v2.1.4 6 Dec 13:58:08 - [info] Node.js version: v16.13.1 6 Dec 13:58:08 - [info] Linux 5.10.75 x64 LE 6 Dec 13:58:09 - [info] Loading palette nodes 2021/12/06 13:58:09 [error] 547#547: 744 connect() failed (111: Connection refused) while connecting to upstream, client: 172.30.32.2, server: a0d7b954-nodered, request: "GET /comms HTTP/1.1", upstream: "http://127.0.0.1:46836/comms", host: "192.168.0.100:8123" 2021/12/06 13:58:11 [error] 547#547: 744 connect() failed (111: Connection refused) while connecting to upstream, client: 172.30.32.2, server: a0d7b954-nodered, request: "GET /comms HTTP/1.1", upstream: "http://127.0.0.1:46836/comms", host: "192.168.0.100:8123" 6 Dec 13:58:12 - [info] Dashboard version 3.1.2 started at /endpoint/ui BAIL ON node-red-contrib-alexa-home-skill/alexa BAIL ON node-red-contrib-modbus/Modbus-Client BAIL ON node-red-contrib-modbus/Modbus-Response BAIL ON node-red-contrib-modbus/Modbus-Read BAIL ON node-red-contrib-modbus/Modbus-Getter BAIL ON node-red-contrib-modbus/Modbus-Flex-Getter BAIL ON node-red-contrib-modbus/Modbus-Write BAIL ON node-red-contrib-modbus/Modbus-Flex-Write BAIL ON node-red-contrib-modbus/Modbus-Server BAIL ON node-red-contrib-modbus/Modbus-Flex-Server BAIL ON node-red-contrib-modbus/Modbus-Queue-Info BAIL ON node-red-contrib-modbus/Modbus-Flex-Connector BAIL ON node-red-contrib-modbus/Modbus-IO-Config BAIL ON node-red-contrib-modbus/Modbus-Response-Filter BAIL ON node-red-contrib-modbus/Modbus-Flex-Sequencer BAIL ON node-red-node-pi-gpio/rpi-gpio 6 Dec 13:58:13 - [warn] ------------------------------------------------------ 6 Dec 13:58:13 - [warn] [node-red-node-rbe/rbe] 'rbe' already registered by module node-red 6 Dec 13:58:13 - [warn] ------------------------------------------------------ 6 Dec 13:58:13 - [info] Settings file : /etc/node-red/config.js 6 Dec 13:58:13 - [info] Context store : 'default' [module=memory] 6 Dec 13:58:13 - [info] User directory : /config/node-red/ 6 Dec 13:58:13 - [warn] Projects disabled : editorTheme.projects.enabled=false 6 Dec 13:58:13 - [info] Flows file : /config/node-red/flows.json 6 Dec 13:58:13 - [info] Server now running at http://127.0.0.1:46836/ 6 Dec 13:58:13 - [info] Starting flows 6 Dec 13:58:15 - [info] Started flows 6 Dec 13:58:16 - [error] [api-current-state:394204ea.fe28fc] Entity could not be found in cache for entity_id: input_boolean.disable_worktime_nodes_reachability_reporting 6 Dec 13:58:16 - [error] [api-current-state:26c21ddb.269c72] Entity could not be found in cache for entity_id: timer.timed_override_worktime_nodes_reachability_reporting 6 Dec 13:58:16 - [error] [api-current-state:Override Req?] Entity could not be found in cache for entity_id: input_boolean.sony_tv_shutdown_override 6 Dec 13:58:16 - [error] [api-call-service:Override Ack] Call-Service attempted without connection to server. 6 Dec 13:58:16 - [error] [ha-entity:update exec state] Sensor update attempted without connection to server. 6 Dec 13:58:16 - [info] [mqtt-broker:2144fa35.54e2a6] Connected to broker: mqtt://192.168.0.100:1883 6 Dec 13:58:16 - [error] [ha-entity:update exec state] Sensor update attempted without connection to server. 6 Dec 13:58:17 - [error] [ha-entity:update exec state] Sensor update attempted without connection to server. 6 Dec 13:58:17 - [error] [ha-entity:update exec state] Sensor update attempted without connection to server. 6 Dec 13:58:17 - [error] [ha-entity:update exec state] Sensor update attempted without connection to server. 6 Dec 13:58:17 - [error] [ha-entity:update exec state] Sensor update attempted without connection to server. 6 Dec 13:58:17 - [error] [ha-entity:update exec state] Sensor update attempted without connection to server. 6 Dec 13:58:17 - [error] [ha-entity:update exec state] Sensor update attempted without connection to server. 6 Dec 13:58:17 - [error] [ha-entity:update exec state] Sensor update attempted without connection to server. 6 Dec 13:58:17 - [error] [ha-entity:update exec state] Sensor update attempted without connection to server. 6 Dec 13:58:17 - [error] [ha-entity:update exec state] Sensor update attempted without connection to server. 6 Dec 13:58:17 - [error] [api-current-state:e4622fc8.393a] Entity could not be found in cache for entity_id: input_boolean.disable_alarm_system_reporting 6 Dec 13:58:17 - [error] [ha-entity:update exec state] Sensor update attempted without connection to server. 6 Dec 13:58:17 - [error] [ha-entity:update exec state] Sensor update attempted without connection to server. 6 Dec 13:58:17 - [error] [ha-entity:update exec state] Sensor update attempted without connection to server. 6 Dec 13:58:17 - [error] [ha-entity:update exec state] Sensor update attempted without connection to server. 6 Dec 13:58:17 - [error] [ha-entity:update exec state] Sensor update attempted without connection to server. 6 Dec 13:58:18 - [info] [server:Home Assistant] Connecting to undefined 6 Dec 13:58:18 - [info] [server:Home Assistant] Connected to undefined

System Health

version core-2021.11.5
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.9.7
os_name Linux
os_version 5.10.75
arch x86_64
timezone Australia/Sydney
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 6.6 -- | -- update_channel | stable supervisor_version | supervisor-2021.10.8 docker_version | 20.10.8 disk_total | 30.8 GB disk_used | 8.7 GB healthy | true supported | true board | ova supervisor_api | ok version_api | ok installed_addons | Samba share (9.5.1), Studio Code Server (3.7.0), TasmoAdmin (0.16.0), MariaDB (2.4.0), Node-RED (10.2.0), Spotify Connect (0.10.0), Terminal & SSH (9.2.1), Mosquitto broker (6.0.1), AirCast (3.2.0), File editor (5.3.3), Check Home Assistant configuration (3.9.0), Home Assistant Google Drive Backup (0.105.2), chrony (2.2.1)
Lovelace dashboards | 1 -- | -- resources | 0 views | 6 mode | storage

I have mashed up some images to further clarify what I am observing as attached;

Home Assistant

Home Assistant.jpg: shows the supervisor and configuration tabs with add-ons and integrations that currently comprise my system.

Node-RED

Node-RED.jpg: shows the HUE nodes that I use in my flows and two examples of the Smart Button device successfully providing input events into the flow (“short released” and “held”) while the Tap Switch devices remain in the “waiting …” state because Node-RED has reset and the events presumably never reach the UI to be updated. After a few seconds, the Smart Button event text returns to the “waiting …” state too.

IOS APP

OS App.jpg: is four screen captures taken from my iPad using the HUE App stitched together to show the successful operation of the tap switches. The first column shows the Office Standing Desk Button 4 is being registered, the second column a few seconds later when the timestamp for that event replaces the green event text. The third and forth columns show the same event recording process for the Downstairs Lights Override tap switch, this time for Button 1.

Notice that the two tap switches and the smart button are “not configured” in the IOS App. This means that the HUE application itself (running in the HUE Bridge device) does not do anything when these button events occur. They are just events that are broadcast to interested parties but the HUE itself takes no action. I have no automations running in any platform other than Node-RED within Home Assistant (not in Apple Home kit either).

zachowj commented 2 years ago

6 Dec 13:58:05 - [error] ReferenceError: sensor is not defined at EventEmitter. (/config/node-red/node_modules/node-red-contrib-huemagic/huemagic/hue-bridge.js:161:38) at EventEmitter.emit (node:events:390:28) at HueBridge.emitUpdates (/config/node-red/node_modules/node-red-contrib-huemagic/huemagic/hue-bridge-config.js:216:18) at /config/node-red/node_modules/node-red-contrib-huemagic/huemagic/hue-bridge-config.js:41:11 at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5)

From your error log, you want the https://github.com/Foddy/node-red-contrib-huemagic repo

isaac-the-newt commented 2 years ago

Hi Jason,

Thanks for the redirect.

I’ve added this to an existing issue https://github.com/Foddy/node-red-contrib-huemagic/issues/246 which appears to have identical symptoms and log entries.

regards,

Greg Belcher

From: Jason @.> Sent: Monday, 6 December 2021 15:09 To: zachowj/hass-node-red @.> Cc: isaac-the-newt @.>; Author @.> Subject: Re: [zachowj/hass-node-red] Philips Hue tap switch nodes generate uncaught exceptions in Node-RED (Issue #89)

6 Dec 13:58:05 - [error] ReferenceError: sensor is not defined at EventEmitter. (/config/node-red/node_modules/node-red-contrib-huemagic/huemagic/hue-bridge.js:161:38) at EventEmitter.emit (node:events:390:28) at HueBridge.emitUpdates (/config/node-red/node_modules/node-red-contrib-huemagic/huemagic/hue-bridge-config.js:216:18) at /config/node-red/node_modules/node-red-contrib-huemagic/huemagic/hue-bridge-config.js:41:11 at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5)

From your error log, you want the https://github.com/Foddy/node-red-contrib-huemagic repo

— You are receiving this because you authored the thread. Reply to this email directly, https://github.com/zachowj/hass-node-red/issues/89#issuecomment-986419624 view it on GitHub, or https://github.com/notifications/unsubscribe-auth/AWY7QE5SU27UOU2XB7M22NTUPQZPHANCNFSM5JNS6JWA unsubscribe. Triage notifications on the go with GitHub Mobile for https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 iOS or https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub Android. https://github.com/notifications/beacon/AWY7QE5VWBOAPTFIIQZLIBTUPQZPHA5CNFSM5JNS6JWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHLFZDKA.gif