Yeah after ruining this for sometime, I am seeing a number of issues like the switches disappearing and hence affecting the flows causing flows to fire and execute some seemingly random behavior. there are some errors in the logs around unbound websocket errors to HA…
How could I use these in conjunction with the bigtimer? i use a lot of flows to turn on and off lights with the bigtimer node. Would like to have a disable switch to disable the timers. This is what I have now. I have to use a change node before the bigtimer to change the “on” to “auto” for the timer to work. But this does not give me the option to put the timer into a override off state.
Just started using this and it is creating sensors successfully in HA
Is there anyway to get the name of the sensor to be a field within the msg.payload
Not really. What’s your use case?
I use it to let my wife know what birthdays are due in our very large family
Nodered reads a file and passes the next two months of birthdays into sensors
These are then displayed on a card so she can just look at the tablet screen
So the number of sensors can vary from month to month
For a similar usage (not birthdays though!), I only use one sensor and put the other informations as an attribute in JSON format.
The sensor value gives the number of items in the list and the list is a json array with values. With this in lovelace, you can do pretty much what you want…
GV
[{"id":"fe43e6cb.441098","type":"ha-api","z":"9ce184b.0f5bb78","name":"","debugenabled":false,"protocol":"websocket","method":"get","path":"","data":"{\t \"type\": \"config/entity_registry/update\",\t \"entity_id\": \"sensor.birthdays\",\t \"name\": payload.name\t}","dataType":"jsonata","location":"payload","locationType":"msg","responseType":"json","x":562,"y":704,"wires":[[]]},{"id":"53a88849.f87f28","type":"inject","z":"9ce184b.0f5bb78","name":"","topic":"","payload":"{\"name\":\"Albert Einstein\",\"date\":\"March 14\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":262,"y":704,"wires":[["fe369a23.97a158"]]},{"id":"fe369a23.97a158","type":"ha-entity","z":"9ce184b.0f5bb78","name":"","server":"913f8aa4.627b78","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"birthdays"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"payload.date","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":406,"y":704,"wires":[["fe43e6cb.441098"]]},{"id":"dd790516.9c5448","type":"inject","z":"9ce184b.0f5bb78","name":"","topic":"","payload":"{\"name\":\"Isaac Newton\",\"date\":\"12/25\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":258,"y":752,"wires":[["fe369a23.97a158"]]}]
I think the same thing is happening for sensor nodes. if I put a sensor node in a subflow it creates multiple entries in home assistant…
Sensor nodes don’t work in subflows because of how they register themselves in Home Assistant with a combination of the server config node id and the sensor node id. The nodes in a subflow get new node ids every time NR reboots.
Have to look into this for the very reason you created it… having to create input bools… do these update the icon color to match status as normal swtiches, etc do?
I’ve almost got the companion component worked out for use with any external process wanting to add devices/entities to Home Assistant. Thank you, again, for your help and contribution.
The only piece of the puzzle I’m missing is getting the “config” bit right for nodered/discovery.
“name” seems to work and hints HASS as to what the entity ID should be. That’s great! I’d like to also get manufacturer, model, version, etc. I can’t quite figure it out though. On the Integrations Panel, all my entities show as “Entities without Devices”.
Is this just not supported by the nodered companion custom component?
They should act like any other switch in HA.
I think I originally had device_info in but took it out because I felt like it didn’t fit into how it was used inside NR.
I think I can add it back into the component without much of an issue. Probably make it another optional parameter of nodered/discovery
called device_info
which should be a key/value object.
That would be fantastic!
Or, if you don’t have the time for that, if you can point me in the right direction on what it would look like, I can make the changes and send you a PR.
The server_id
will be the identifier for the device. All components that have the same server_id
will show up under a single device. You can then use node_id
as the identifier for the component.
Here’s an example of what input would be:
{
"type":"nodered/discovery",
"component":"sensor",
"server_id":"device_indentifier",
"node_id":"component_indentifier",
"device_info":{
"name": "name of device",
"manufacturer":"NR",
"model":"the crappy one",
"sw_version":"0.0.0-alpha"
}
}
How does that sound to you?
That sounds perfect!
I changed the property that identifies the device to id
of device_info
.
{
"type":"nodered/discovery",
"component":"sensor",
"server_id":"server_id",
"node_id":"node_id",
"device_info":{
"id": "device_id",
"name": "name of device",
"manufacturer":"NR",
"model":"the crappy one",
"sw_version":"0.0.0-alpha"
}
}
This version has been released v0.2.0
So, if “id” in “device_info” is the same for more than one entity, they will be bundled together on the integration page, right?
Does it matter if server_id is the same too? Or just “id”?
Yes
Just id
. I decided to do it that way in case I wanted to implement it in NR at some point again.
That’s fantastic!!!
I should have some time to integrate this tomorrow.
You rock!