Currently, there is no “force_update” on the NR entity node.
You can fake it by adding another attribute to the entity that could be named anything with the value as timestamp
.
Currently, there is no “force_update” on the NR entity node.
You can fake it by adding another attribute to the entity that could be named anything with the value as timestamp
.
Thanks for reply. Unfortunately, this didn’t do the trick.
I added attribute updated
, assigned it to timestamp
and it is indeed changing, however, since the temperature value doesn’t change, it’s reporting as “dead sensor”.
Perhaps I’d need to rethink the whole concept. Any ideas, how to approach this?
I’ve gotten the new Philips Hue Dimmer Switch that has a Power button instead of On/Off buttons so I want to create a logic for toggling the lights using just one button. The button has to toggle two (or more) lights so the logic can’t be as simple as using “homeassistant.toggle”.
The logic should be:
For implementing that I would need to get the state of all related lights and based on their ON/OFF states determine what to do.
I wonder if anyone has suggestions on how to do that. It seems like the “Current state” node can only get the state of one entity so that seems the biggest blocker for me.
Once I get the state I guess I can write some custom JS logic using the “Function” node since I don’t think this addon has anything so specific to my use case.
Use a HA group with all the lights. If it’s on there’s at least one light on the group is on and if they are all off the group is off
Thanks. That would work nicely but I want to depend as little as possible on HA configuration in NodeRed so as to not have to maintain two moving pieces at the same time.
I’ve implemented that using the “Get entities” node (apparently it can get states of multiple entities using regexp) + a custom function node that returns a payload formatted for the “Call service” node.
Hi,
I’ve just posted this topic about a problem with the service homeassistant set_location which is demanding a lot of memory (until my Pi freezes).
I’m just linking from here, since I’ve got the feeling people are reading here, who can help me out.
Thanks!
Hi,
I’ve a problem with using global variable in render template node.
This example doesn’t work:
[{"id":"4da1c3b6.ecf84c","type":"change","z":"1497555b.20160b","name":"","rules":[{"t":"set","p":"var1","pt":"global","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":1580,"wires":[["15b0ee15.17c1f2"]]},{"id":"15b0ee15.17c1f2","type":"api-render-template","z":"1497555b.20160b","name":"test","server":"f52dc269.9226a","template":"{{ global.var1 }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":610,"y":1580,"wires":[["a8c839d6.c4f668"]]},{"id":"aee883ee.441c","type":"inject","z":"1497555b.20160b","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":210,"y":1580,"wires":[["4da1c3b6.ecf84c"]]},{"id":"a8c839d6.c4f668","type":"debug","z":"1497555b.20160b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":790,"y":1580,"wires":[]},{"id":"f52dc269.9226a","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
Help, plz.
Hi,
The home-assistant template doesn’t see node-red scoped variables. You can get around this by stringing together a node-red template then a home-assistant template. Here’s your example with an additional node-red template node. The node-red template makes a string that will be expanded by the home-assistant template, so 1. I had to change the delimiter so that the {{ }}'s were preserved in the output, 2. I added a home-assistant variable to expand (assuming you have a sun sensor).
[{"id":"aee883ee.441c","type":"inject","z":"1c7b6f3e.2903c9","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":90,"y":140,"wires":[["4da1c3b6.ecf84c"]]},{"id":"4da1c3b6.ecf84c","type":"change","z":"1c7b6f3e.2903c9","name":"","rules":[{"t":"set","p":"var1","pt":"global","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":140,"wires":[["9d37cf2c.baae78"]]},{"id":"9d37cf2c.baae78","type":"template","z":"1c7b6f3e.2903c9","name":"","field":"template","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{=<% %>=}}\n{{ (10.5 * <% global.var1 %>)|int }}\n{{ states.sun.sun.state }}","output":"str","x":470,"y":140,"wires":[["937938be.5629e8","15b0ee15.17c1f2"]]},{"id":"937938be.5629e8","type":"debug","z":"1c7b6f3e.2903c9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"template","targetType":"msg","statusVal":"","statusType":"auto","x":620,"y":100,"wires":[]},{"id":"15b0ee15.17c1f2","type":"api-render-template","z":"1c7b6f3e.2903c9","name":"test","server":"f52dc269.9226a","template":"","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":650,"y":140,"wires":[["a8c839d6.c4f668"]]},{"id":"a8c839d6.c4f668","type":"debug","z":"1c7b6f3e.2903c9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":810,"y":140,"wires":[]},{"id":"f52dc269.9226a","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
Hope that helps,
Benjamin
Firstly, thanks Kermit for all your hard work on this, really appreciated.
Can anyone point me to some instructions on using the trigger-state node? I thought I had it figured out, but no matter what I try I keep messing it up, so I feel I need some ELI5 explanation and my Google searches have failed me.
I’m just trying to test it out with something simple where when a light in my office is turned on it outputs a custom boolean message of true, as below. Sadly the debug shows multiple lines of the state of the office light, not the true message I was expecting. I’m sure I’m doing something wrong and that it’s dead simple but I just can’t figure it out.
seems good to me
[{"id":"a8b197db.7713f8","type":"trigger-state","z":"f61766ce.f85398","name":"","server":"","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"input_boolean.test","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on","propertyValue":"new_state.state"}],"outputs":3,"customoutputs":[{"messageType":"custom","messageValue":"true","messageValueType":"bool","comparatorPropertyType":"always","comparatorType":"is","comparatorValue":"","comparatorValueDataType":"str","comparatorPropertyValue":""}],"outputinitially":false,"state_type":"str","x":240,"y":3280,"wires":[[],[],["3d39521d.effe8e"]]},{"id":"3d39521d.effe8e","type":"debug","z":"f61766ce.f85398","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":466,"y":3280,"wires":[]}]
Thanks, once again, no idea what I’d messed up but that’s working just as I wanted.
I have been attempting to migrate my automations to Node Red and have run into a bit of a snag. Some of my existing (non-NR) automations permit me to enable / disable them from the lovelace UI. I would like this functionality while using NR and apparently this thread indicates that this IS possible. Unfortunatly I am unable to get this to work. My NR is running in a docker container, My HA is also running Core in docker. I have created the Long lived access token in NR, and NR is controlling my devices when I create flows. I have installed the Node-red-contrib-home-assistant-websocket, I have installed the HACS Node-Red Companion, and I have installed the Node Red-Companion integration. My NR can see all my HA entities but I am not seeing any NR entities begin created in HA that I can enable / disable my flows. Am I missing something?
When you edit an event node towards the bottom of the config window should be Expose to Home Assistant
I am sure I did not see that before you posted. Maybe a reset or re-creating the access token revealed it. Thanks
A beta has been released for the next version. If you’re feeling adventurous please give it a try and leave some feedback.
Release notes and discussion can be found here https://github.com/zachowj/node-red-contrib-home-assistant-websocket/discussions/382
Thanks for your work on this great set of nodes. A feature that I’d like to request (if not possible yet already) to help make my system a bit more stable: monitor if NR loses the connection to HA, and be able to us that info in a sequence.
You could use an events: all node listening for home_assistant_client
.
There always seemed to be confusion over why the call-service node would report an error of no connection to server
. This error is often thrown when using a starting node that fires directly after loading, i.e. Bigtimer, eztimer. The cause was that the node would trigger the flow before the HA config node had a chance to connect to Home Assistant hence no connection to server
. This update adds a queue system to the call-service node. With the ability to save only the first/last message or all messages and then resend them after NR has successfully connected to HA.
Home Assistant nonevent nodes will notify the Node-RED runtime when it has completed its action. Basically, the complete node will now function with HA nodes.
https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/jsonata.html
The node migration system has been reworked and allows for updating all HA nodes with a push of a single button. With this release, a lot of nodes have changed how certain data is saved. So it is highly recommended to make a backup of your flows before doing upgrades.
Double post, but I think better fit…
please help me out… I have 772 home assistant nodes…
Hi, I recently had this message upon starting node-red:
(screenshot from my test instance)
And this when pressing:
But I decided not yet to press it… so I opened 1 node and did not save…
then the button disappeared and now I think I have to manually open and save all nodes?
Is there a better way? And what is it for?
If you still have any “old” nodes refreshing the page should bring back the button.
You can also open up a console in your browser dev tools and run the function nodeVersion.getOldNodeCount()
. That will show how many actual “old” nodes you still have.