# Hubitat nodes crashing Node-RED

**URL:** <https://discourse.nodered.org/t/hubitat-nodes-crashing-node-red/36440>\
**Category:** General\
**Created:** [24 November 2020 08:56 UTC](https://discourse.nodered.org/t/hubitat-nodes-crashing-node-red/36440 "2020-11-24T08:56:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkdfkup](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bkdfkup/32/33024_2.png) [@bkdfkup](https://discourse.nodered.org/u/bkdfkup)\
**Post date:** [24 November 2020 08:56 UTC](https://discourse.nodered.org/t/hubitat-nodes-crashing-node-red/36440/1 "2020-11-24T08:56:49Z")

</div>

Hi all!

I am hitting an issue with (some) node-red-contrib-hubitat nodes crashing node-RED, requiring a --safe restart and disabling flows until i can get it to stay working. The following error appears in an SSH terminal during the crash, grateful for any guidance to identify the culprit:

24 Nov 08:51:40 - [info] Started flows  
24 Nov 08:51:40 - [red] Uncaught Exception:  
24 Nov 08:51:40 - TypeError: Cannot read property 'attributes' of undefined  
at HubitatDeviceNode.\_inputCallback (/home/bkdfkup/.node-red/node\_modules/node-red-contrib-hubitat/nodes/device.js:171:56)  
at /usr/lib/node\_modules/node-red/node\_modules/@node-red/runtime/lib/nodes/Node.js:203:26  
at Object.trigger (/usr/lib/node\_modules/node-red/node\_modules/@node-red/runtime/lib/hooks.js:113:9)  
at HubitatDeviceNode.Node.\_emitInput (/usr/lib/node\_modules/node-red/node\_modules/@node-red/runtime/lib/nodes/Node.js:195:11)  
at HubitatDeviceNode.Node.emit (/usr/lib/node\_modules/node-red/node\_modules/@node-red/runtime/lib/nodes/Node.js:179:25)  
at HubitatDeviceNode.Node.receive (/usr/lib/node\_modules/node-red/node\_modules/@node-red/runtime/lib/nodes/Node.js:476:10)  
at Immediate. (/usr/lib/node\_modules/node-red/node\_modules/@node-red/runtime/lib/flows/Flow.js:657:52)  
at processImmediate (node:internal/timers:463:21)  
at process.topLevelDomainCallback (node:domain:144:15)  
at process.callbackTrampoline (node:internal/async\_hooks:127:14)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [24 November 2020 09:02 UTC](https://discourse.nodered.org/t/hubitat-nodes-crashing-node-red/36440/2 "2020-11-24T09:02:36Z")

</div>

I'd suggest you raise an issue against the Hubitat node with that stack trace. I looks like its missing the error handling it should have it it tries to access an unknown device.

> **[fblackburn1/node-red-contrib-hubitat](https://github.com/fblackburn1/node-red-contrib-hubitat/issues)**
>
> Contribute to fblackburn1/node-red-contrib-hubitat development by creating an account on GitHub.

In this instance, I can see we could also add some error handling in the core of Node-RED to capture this and report it back without causing the Uncaught Exception - something for 1.2.6.

---

<div class="post-metadata">

**Author:** ![bkdfkup](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bkdfkup/32/33024_2.png) [@bkdfkup](https://discourse.nodered.org/u/bkdfkup)\
**Post date:** [24 November 2020 09:13 UTC](https://discourse.nodered.org/t/hubitat-nodes-crashing-node-red/36440/3 "2020-11-24T09:13:01Z")

</div>

Thanks for the advice. I have submitted an issue to fblackburn1/node-red-contrib-hubitat as recommended.

Its an odd one, as it only happened after updating the nodes, and only happens if the device node has an input (in my case a timestamp set at intervals) configured.

---

<div class="post-metadata">

**Author:** ![bkdfkup](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bkdfkup/32/33024_2.png) [@bkdfkup](https://discourse.nodered.org/u/bkdfkup)\
**Post date:** [24 November 2020 09:24 UTC](https://discourse.nodered.org/t/hubitat-nodes-crashing-node-red/36440/4 "2020-11-24T09:24:20Z")

</div>

OK, i have narrowed it down to this only occurring if "Inject once after 0.1 seconds, then" is enabled in the inject node. If this is disabled, all works as expected, with the Hubitat node updating its values every 1 second. It seems odd that the initial injection is having an impact.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [24 November 2020 09:26 UTC](https://discourse.nodered.org/t/hubitat-nodes-crashing-node-red/36440/5 "2020-11-24T09:26:56Z")

</div>

I suspect its a timing issue - injecting the message so early that the hubitat node hasn't finished initialising itself.

---

<div class="post-metadata">

**Author:** ![bkdfkup](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bkdfkup/32/33024_2.png) [@bkdfkup](https://discourse.nodered.org/u/bkdfkup)\
**Post date:** [24 November 2020 09:31 UTC](https://discourse.nodered.org/t/hubitat-nodes-crashing-node-red/36440/6 "2020-11-24T09:31:39Z")

</div>

Possibly, I have posted the same findings to Git, so hopefully the dev can provide advice.

Thanks for your assistance

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [24 November 2020 17:51 UTC](https://discourse.nodered.org/t/hubitat-nodes-crashing-node-red/36440/7 "2020-11-24T17:51:56Z")

</div>

Check this...

> **[Node-RED nodes for hubitat](https://community.hubitat.com/t/node-red-nodes-for-hubitat/34386/4218)**
>
> .1s after reboot? I'm surprised they don't all fail. I wait typically no less than 10s reboot before triggering flow updates. It takes a bit of time for the Hubitat nodes to initialize after a node-red (or Hubitat) restart.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [23 January 2021 17:51 UTC](https://discourse.nodered.org/t/hubitat-nodes-crashing-node-red/36440/8 "2021-01-23T17:51:58Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
