Node-RED nodes for hubitat

I want to make sure I am clear on this... if I restart an HE hub - is it a reasonable idea to do a get "/devices/all" for that hub first thing after startup? The idea being to rebuild the cache at the beginning.

I know I don't want to do this on redeploys of course.

Good question. Don't know?

I'm not even 100% sure at this point that doing a request node w/"devices/all" rebuilds the internal cache at all like receiving normal events does...

I guess we'll need @fblackburn to educate us.

1 Like

Is anyone else having a random issue where multiple lights comes on without ANY logic/rule/flow triggering it?

This behavior began with the update to 2.2, that's all that has changed in my setup. It even affects light that are NOT used or called on by anything, ones that i almost never use and only manually turn on and off from the device page.

It's not driver dependent as it affects both my tasmota and magichome devices.

Figured I'd ask here before I try to bug @bobbyD for a cause/solution.

All built in nodes, a couple flow variables, and a couple JSONata functions.

[{"id":"73d0e758.199e58","type":"hubitat device","z":"c3eeca95.6969b8","name":"DR Lights","server":"d0c8b8e.6894848","deviceId":"7","attribute":"switch","sendEvent":true,"x":340,"y":1600,"wires":[["824054f1.ddf89"]]},{"id":"ecd513df.af259","type":"hubitat device","z":"c3eeca95.6969b8","name":"LR Lights","server":"d0c8b8e.6894848","deviceId":"1153","attribute":"switch","sendEvent":true,"x":340,"y":1660,"wires":[["3cbd9b9e.631b34"]]},{"id":"7ec47e27.30a83","type":"inject","z":"c3eeca95.6969b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":1600,"wires":[["73d0e758.199e58","ecd513df.af259"]]},{"id":"824054f1.ddf89","type":"change","z":"c3eeca95.6969b8","name":"on=1, off=0","rules":[{"t":"set","p":"switch1","pt":"flow","to":"$contains(payload.value,\"on\") ? 1:0","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":1600,"wires":[["81ade7b3.5e395"]]},{"id":"3cbd9b9e.631b34","type":"change","z":"c3eeca95.6969b8","name":"on=1, off=0","rules":[{"t":"set","p":"switch2","pt":"flow","to":"$contains(payload.value,\"on\") ? 1:0","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":1660,"wires":[["81ade7b3.5e395"]]},{"id":"81ade7b3.5e395","type":"change","z":"c3eeca95.6969b8","name":"sum","rules":[{"t":"set","p":"payload","pt":"msg","to":"$flowContext('switch1')+$flowContext('switch2')","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":1640,"wires":[["4f9af8cd.6bc06"]]},{"id":"3bdd63e3.bde034","type":"debug","z":"c3eeca95.6969b8","name":"Both off","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"\"Both Off: \" & payload","targetType":"jsonata","x":1080,"y":1580,"wires":[]},{"id":"4f9af8cd.6bc06","type":"switch","z":"c3eeca95.6969b8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"2","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":890,"y":1640,"wires":[["3bdd63e3.bde034"],["8122e207.6bb9c"],["b987915e.ab6c38"]]},{"id":"8122e207.6bb9c","type":"debug","z":"c3eeca95.6969b8","name":"1 on","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"\"Only 1 on: \" & payload","targetType":"jsonata","x":1070,"y":1640,"wires":[]},{"id":"b987915e.ab6c38","type":"debug","z":"c3eeca95.6969b8","name":"Both on","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"\"Both on: \" & payload","targetType":"jsonata","x":1080,"y":1700,"wires":[]},{"id":"d0c8b8e.6894848","type":"hubitat config","z":"","name":"Hubitat","usetls":false,"host":"192.168.1.17","port":"80","token":"e5653e7e-56a0-43fc-8e19-96a6d9f22711","appId":"2834","nodeRedServer":"http://192.168.1.10:1882","webhookPath":"/hubitat/webhook"}]
2 Likes

Nope.

You are going to have to connect one switch event nodes output with the other one's input and vice versa for production (ie when using send events). Otherwise a better/simpler alternative than my function node which I was pm-ing @bdygrp. Cool!!!

Well your not using Wifi lights are you?

I am experiencing odd rapid switching of lights from time to time that just started but am attributing that to a combo of my startup/init routines and some of my more awkward sequences.. most likely my fault though.

No, I'm not.

Sorry, I missed that part in your post.

Yeah nothing like that here... Im basically experiencing what some with zigbee bulbs were dealing with back in feb, only on wifi lights instead of zigbee.

Sorry if that came across nasty or short, was not my intent!

1 Like

My thought was something in the Maker API was causing extra stuff to be triggered or delayed. I haven't eliminated my sequences as the issue first though which is more likely.

Don't you get an infinite loop? Why not an inject once after 0.1 second setting on an inject node?

Im actually wondering about this being the cause myself as it was immediately after the update that my issues began and they made adjustments to the maker api...

I have almost nothing on my hub, its pretty much 100% just a device interface at this point. No user apps, only 4 system apps (google home, maker api, lock manager and mode manager) no rules.

Looking through my logs we see a flurry of un triggered activity as multiple lights all turn on at once, followed shortly by a maker api error with the database.

[dev:942](http://192.168.0.7/logs/past#dev942)2020-04-30 06:35:13.017 am [info](http://192.168.0.7/device/edit/942)'switch' set to 'off'

[dev:944](http://192.168.0.7/logs/past#dev944)2020-04-30 06:35:12.175 am [info](http://192.168.0.7/device/edit/944)'switch' set to 'off'

[dev:942](http://192.168.0.7/logs/past#dev942)2020-04-30 06:35:11.834 am [info](http://192.168.0.7/device/edit/942)'switch' set to 'off'

[dev:948](http://192.168.0.7/logs/past#dev948)2020-04-30 06:35:10.397 am [info](http://192.168.0.7/device/edit/948)'switch' set to 'off'

[dev:946](http://192.168.0.7/logs/past#dev946)2020-04-30 06:35:10.156 am [info](http://192.168.0.7/device/edit/946)'switch' set to 'off'

[dev:946](http://192.168.0.7/logs/past#dev946)2020-04-30 06:35:10.006 am [info](http://192.168.0.7/device/edit/946)'switch' set to 'off'

[dev:410](http://192.168.0.7/logs/past#dev410)2020-04-30 06:35:08.536 am [info](http://192.168.0.7/device/edit/410)'switch' set to 'off'

[dev:951](http://192.168.0.7/logs/past#dev951)2020-04-30 06:35:08.161 am [info](http://192.168.0.7/device/edit/951)'switch' set to 'off'

[app:905](http://192.168.0.7/logs/past#app905)2020-04-30 06:35:07.643 am [error](http://192.168.0.7/installedapp/configure/905)org.h2.jdbc.JdbcSQLException: Column "name" not found [42122-197] on line 360 (sendDeviceCommand)

[dev:521](http://192.168.0.7/logs/past#dev521)2020-04-30 06:31:38.567 am [warn](http://192.168.0.7/device/edit/521)Presence time-out reached, setting device as 'not present'!

[dev:939](http://192.168.0.7/logs/past#dev939)2020-04-30 06:31:38.456 am [warn](http://192.168.0.7/device/edit/939)Presence time-out reached, setting device as 'not present'!

[dev:938](http://192.168.0.7/logs/past#dev938)2020-04-30 06:31:38.001 am [warn](http://192.168.0.7/device/edit/938)Presence time-out reached, setting device as 'not present'!

[dev:941](http://192.168.0.7/logs/past#dev941)2020-04-30 06:31:34.748 am [warn](http://192.168.0.7/device/edit/941)Presence time-out reached, setting device as 'not present'!

[dev:940](http://192.168.0.7/logs/past#dev940)2020-04-30 06:31:34.544 am [warn](http://192.168.0.7/device/edit/940)Presence time-out reached, setting device as 'not present'!

[dev:718](http://192.168.0.7/logs/past#dev718)2020-04-30 06:31:30.231 am [warn](http://192.168.0.7/device/edit/718)Presence time-out reached, setting device as 'not present'!

[dev:950](http://192.168.0.7/logs/past#dev950)2020-04-30 06:31:30.113 am [warn](http://192.168.0.7/device/edit/950)Presence time-out reached, setting device as 'not present'!

[dev:268](http://192.168.0.7/logs/past#dev268)2020-04-30 06:25:42.376 am [info](http://192.168.0.7/device/edit/268)Master Bedroom Motion temperature is 71.89°F

[dev:844](http://192.168.0.7/logs/past#dev844)2020-04-30 06:25:23.459 am [info](http://192.168.0.7/device/edit/844)Kitchen Motion Sensor 2 is 55%RH

[dev:944](http://192.168.0.7/logs/past#dev944)2020-04-30 06:24:37.799 am [info](http://192.168.0.7/device/edit/944)'switch' set to 'on'

[dev:522](http://192.168.0.7/logs/past#dev522)2020-04-30 06:24:37.713 am [info](http://192.168.0.7/device/edit/522)'switch' set to 'on'

[dev:942](http://192.168.0.7/logs/past#dev942)2020-04-30 06:24:36.906 am [info](http://192.168.0.7/device/edit/942)'switch' set to 'on'

[dev:942](http://192.168.0.7/logs/past#dev942)2020-04-30 06:24:34.923 am [info](http://192.168.0.7/device/edit/942)'switch' set to 'on'

[dev:944](http://192.168.0.7/logs/past#dev944)2020-04-30 06:24:34.217 am [info](http://192.168.0.7/device/edit/944)'switch' set to 'on'

[dev:948](http://192.168.0.7/logs/past#dev948)2020-04-30 06:24:33.603 am [info](http://192.168.0.7/device/edit/948)'switch' set to 'on'

[dev:522](http://192.168.0.7/logs/past#dev522)2020-04-30 06:24:33.148 am [info](http://192.168.0.7/device/edit/522)'colorTemperature' set to '5000'

[dev:946](http://192.168.0.7/logs/past#dev946)2020-04-30 06:24:33.026 am [info](http://192.168.0.7/device/edit/946)'switch' set to 'on'

[dev:522](http://192.168.0.7/logs/past#dev522)2020-04-30 06:24:32.068 am [info](http://192.168.0.7/device/edit/522)'switch' set to 'on'

[dev:942](http://192.168.0.7/logs/past#dev942)2020-04-30 06:24:30.955 am [info](http://192.168.0.7/device/edit/942)'switch' set to 'on'

[dev:944](http://192.168.0.7/logs/past#dev944)2020-04-30 06:24:30.207 am [info](http://192.168.0.7/device/edit/944)'switch' set to 'on'

[dev:948](http://192.168.0.7/logs/past#dev948)2020-04-30 06:24:28.796 am [info](http://192.168.0.7/device/edit/948)'switch' set to 'on'

[dev:946](http://192.168.0.7/logs/past#dev946)2020-04-30 06:24:28.380 am [info](http://192.168.0.7/device/edit/946)'switch' set to 'on'

[dev:951](http://192.168.0.7/logs/past#dev951)2020-04-30 06:24:28.296 am [info](http://192.168.0.7/device/edit/951)'switch' set to 'on'

[dev:719](http://192.168.0.7/logs/past#dev719)2020-04-30 06:24:28.091 am [info](http://192.168.0.7/device/edit/719)'switch' set to 'on'

[dev:718](http://192.168.0.7/logs/past#dev718)2020-04-30 06:24:27.522 am [info](http://192.168.0.7/device/edit/718)parse(asyncResponse.getJson() = "[POWER:ON, Dimmer:100, Color:FFFFFFFFFF, HSBColor:0,0,100, White:100, CT:327, Channel:[100, 100, 100, 100, 100]]")

[dev:719](http://192.168.0.7/logs/past#dev719)2020-04-30 06:24:27.205 am [info](http://192.168.0.7/device/edit/719)'switch' set to 'on'

[dev:718](http://192.168.0.7/logs/past#dev718)2020-04-30 06:24:27.092 am [info](http://192.168.0.7/device/edit/718)Using httpGetAction for 'http://192.168.0.151:80/cm?cmnd=Dimmer%20100'...

[dev:718](http://192.168.0.7/logs/past#dev718)2020-04-30 06:24:26.924 am [info](http://192.168.0.7/device/edit/718)parse(asyncResponse.getJson() = "[POWER:ON, Dimmer:100, Color:FFFFFFFFFF, HSBColor:0,0,100, White:100, CT:327, Channel:[100, 100, 100, 100, 100]]")

[dev:944](http://192.168.0.7/logs/past#dev944)2020-04-30 06:24:25.699 am [info](http://192.168.0.7/device/edit/944)'switch' set to 'on'

[dev:942](http://192.168.0.7/logs/past#dev942)2020-04-30 06:24:24.434 am [info](http://192.168.0.7/device/edit/942)'switch' set to 'on'

[dev:948](http://192.168.0.7/logs/past#dev948)2020-04-30 06:24:24.290 am [info](http://192.168.0.7/device/edit/948)'switch' set to 'on'

[dev:946](http://192.168.0.7/logs/past#dev946)2020-04-30 06:24:23.932 am [info](http://192.168.0.7/device/edit/946)'switch' set to 'on'

[dev:946](http://192.168.0.7/logs/past#dev946)2020-04-30 06:24:19.955 am [info](http://192.168.0.7/device/edit/946)'switch' set to 'on'

[dev:951](http://192.168.0.7/logs/past#dev951)2020-04-30 06:24:19.602 am [info](http://192.168.0.7/device/edit/951)'switch' set to 'on'

[dev:948](http://192.168.0.7/logs/past#dev948)2020-04-30 06:24:19.481 am [info](http://192.168.0.7/device/edit/948)'switch' set to 'on'

[dev:718](http://192.168.0.7/logs/past#dev718)2020-04-30 06:24:18.918 am [info](http://192.168.0.7/device/edit/718)Using httpGetAction for 'http://192.168.0.151:80/cm?cmnd=Dimmer%20100'...

[dev:267](http://192.168.0.7/logs/past#dev267)2020-04-30 06:22:14.282 am [info](http://192.168.0.7/device/edit/267)Kitchen Motion battery is 99% 

Mind you no one was up at this time, nothing was triggered, and 2 of the lights turned on are not included in any rules or flows, Maker API just has access to them for when I get around to setting them up as visual alerts.

How do you know that it was MakerAPI that moved them, though? Those switch 'on' and 'off' logs are all just from the device (aren't they?).

I would turn on MakerAPI logging, if you want to be 100% sure that is what is doing it.

No !!
requesting /devices/all does absolutely nothing in the internal nodes.
Each node is independent for its initialization.

In my battery graph the GET /devices/all was only to populate graph after NR restart. Otherwise you can use values stored in a file or nothing and wait after events

Receiving event does not rebuild any cache either! The cache is ONLY built on NR start and updated with event. If on NR start, the cache cannot be initialized, then the node status will be red and on the next event (for this device) a new try to update cache will be done

There are no mechanism to resync all devices state. And I don't see a lot of reason to be desync. Not impossible, but not really easy. Anyways after receiving an event, the state will be resynced by the event value

2 Likes

Okay understand. Thanks for the information!

Logging of MakerAPI didn't show anything that indicated what triggered or caused it and was slowing my hub down so i turned it back off last night.

I think its something in the MakerApi because if a light isnt shared via it, it doesnt randomly come on by itself, and they just altered how makerapi works again to allow us to issue commands properly escaped so we can issue HSL etc as a single command.

Example... I have a light that HE has installed as a device, that is not shared with the makerapi, BUT is also in Node Red via direct http commands.

That light does NOT come on with the others.

Another light which is shared via makerAPI AND also is controlled direct via http commands in NR DOES turn on with the rest when this issue happens.

I set those lights up specifically to try and trace this down before I inquired here. I honestly figured I had done something stupid to cause this so I triple checked everything I could think of before posting :confused:

1 Like

BobbyD just messaged me (Thanks for the super fast reply btw!) and let me know the issue has been forwarded, he advised rolling back until they can push out a fix.

Thanks everyone else for trying to help me figure it out in the meantime!

Now back to these awesome flows :wink:

That wording is confusing (bolded emphasis added by me).

Did you mean that manually triggering a device node with an incoming msg does not update the cache?

If so, then I need to stop doing that on reboot/init... (EDIT: never mind that part, I forgot I do that for another reason altogether... lol)

I mean that if you receive an event, all the cache will not be resynced with HE (e.i. the node will not request HE to update its cache), only the new value received in the event will be saved in the internal node property

:sweat_smile: I don't want to add confusion, here's how it works

  • NR start --> all nodes will request HE to have their current values
  • then internal values are only updated with events

The special logic if the first step fail:

  • NR start --> request HE to fetch a device state --> BUT HE fail to response (500/503/timeout)
  • then the device node status will be red with an error message
  • receive a new event related to this device
  • the node will try to request HE to fetch device state again
2 Likes