Future release of the integration
Looked at the code to see if there was something I could contribute with but noticed something else.
In binary_sensor.py it says
on_states = (
"1",
"true",
"yes",
"enable",
STATE_ON,
STATE_OPEN,
STATE_HOME,
STATE_LOCKED,
)
Without looking further into it it seems LOCKED is regarded as on but the documentation says
lock :
on
means open (unlocked),off
means closed (locked)
Is this as intended?
You are correct that should be swapped.
Hello
Iām not sure Iām at right place. Hope so.
I already successfully created a few entity nodes and they work as expected.
For unknown reasons Iām not able to make generic sensor, created by NodeRed to work. HAās Sensor integration docs says:
Device Class: None : Generic sensor. This is the default and doesnāt need to be set.
But value of entity with no class set is shown by lovelace as āunknownā
Here is how the node is defined:
[
{
"id": "e54e46de.e47868",
"type": "ha-entity",
"z": "a74a1247.24c79",
"name": "Waste Bio",
"server": "6cdd0bc8.b8e434",
"version": 1,
"debugenabled": false,
"outputs": 1,
"entityType": "sensor",
"config": [
{
"property": "name",
"value": "Waste Bio"
},
{
"property": "device_class",
"value": ""
},
{
"property": "icon",
"value": ""
},
{
"property": "unit_of_measurement",
"value": ""
}
],
"state": "payload",
"stateType": "msg",
"attributes": [],
"resend": true,
"outputLocation": "",
"outputLocationType": "none",
"inputOverride": "allow",
"x": 980,
"y": 380,
"wires": [
[]
]
},
{
"id": "6cdd0bc8.b8e434",
"type": "server",
"z": "",
"name": "Home Assistant"
}
]
On the other hand, node with class pressure, units: hPa works, just to prove that everything is installed as needed.
Another issues are followers of first one:
- if I change settings of such previously created generic sensor, for example by setting class to pressure and units to hPa, HAās Lovelace reacts on the change of the type by changing icon, but value remains unknown
- how can I remove entities created by NodeRed? Removing from NodeRed is not enough. Integration of node red doesnāt offer such functionality. Remove option in HAās Entities list rejects removal request
BTW: In Entity node properties, in āServerā dropdown list I have several (I think 4) items āHome Assistantā. Is it OK?
Thanx in advance
with regards
What do you have your deploy method set to?
https://github.com/zachowj/hass-node-red/issues/15#issuecomment-604372757
edit:
You should only have one server connection unless youāre connecting to more than one HA server. The others were probably added when you imported someoneās example.
@kermit which post you are answering to? While I can answer on your first question (Iām using Full which is default), then your edit seems not applying to my question at all.
Hello everyone,
is it possible to have this exposed interfaces appear as disabled at HA start?
thanks
I have a similar question. Switches seem to be āenabledā whenever HA is started. Thereās no option āResend state and attributesā for switches like there is for binary sensor and sensor.
Edit: Iāll explain a bit more. I have a switch which is exposed to HA. Then I have a āstate_changedā node which is doing stuff depending on if the state of the switch is on or off - on restart of HA it resends the state and the flow continues even though the value has not changed. So if it was on before restart -> after restart it will resend āonā and that messes my flowā¦
Edit 2: I originally tried just using the two outputs on the āentity nodeā switch, but they donāt seem to do anything even if the node itself turns on or off.
Any tips for setting the āAttributesā in the entity node?
Iām looking to setup an occupancy sensor with an off_delay of 30 seconds.
Iāve tried the following with no luck.
In my case HA had not fully started as my TP-Link integration was not starting quickly as one of the devices was powered off. When I powered on that one TP-Link device then HA was able to start, and Node-Red was able to connect to HA.
Is it possible, via NR function or similar, to set the various attributes for the entity node ?
eg, i have a list of things from a web endpoint, and i want to create sensors for each of them, and set the releveant value
lets keep it simple to illustrate
lets say my json is
{ "list": [
"name":"one",
"value":1
],
"name":"two",
"value":2
]
}
id like to be able to process that payload, and crate sensors
sensor.list_one => 1
sensor.list_two => 2
Ive already got the json bit sorted, i just need to work out how to send the relevant info to the new entity node.
I can also set the āstateā via msg.payload, but its the name of the sensor that im struggling with.
Is that doable somehow, or is the entity registered in HA when the node is added to the flow, as opposed to when its executed IN the flow?
If you want to have dynamically created sensors you need use the api node.
https://community.home-assistant.io/t/help-merging-2-node-red-flows-in-1/154642/23?u=kermit
If your names are static you can just do something like this.
[{"id":"cf1d52e4.773f4","type":"inject","z":"ffbd7f06.4a014","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"list\":[{\"name\":\"one\",\"value\":1},{\"name\":\"two\",\"value\":2}]}","payloadType":"json","x":130,"y":1168,"wires":[["e4cd4ae9.aaa0e8"]]},{"id":"ed33a2ac.e19d3","type":"switch","z":"ffbd7f06.4a014","name":"","property":"payload.name","propertyType":"msg","rules":[{"t":"eq","v":"one","vt":"str"},{"t":"eq","v":"two","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":578,"y":1168,"wires":[["dd99d34c.561e"],["3b3ced96.0e72a2"]]},{"id":"7fd79af.3afad64","type":"split","z":"ffbd7f06.4a014","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":450,"y":1168,"wires":[["ed33a2ac.e19d3"]]},{"id":"e4cd4ae9.aaa0e8","type":"change","z":"ffbd7f06.4a014","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.list","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":288,"y":1168,"wires":[["7fd79af.3afad64"]]},{"id":"dd99d34c.561e","type":"ha-entity","z":"ffbd7f06.4a014","name":"one","server":"2dad33ee.42bf5c","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"one"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"payload.value","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":722,"y":1168,"wires":[[]]},{"id":"3b3ced96.0e72a2","type":"ha-entity","z":"ffbd7f06.4a014","name":"two","server":"2dad33ee.42bf5c","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"two"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"payload.value","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":724,"y":1216,"wires":[[]]}]
Thanks, thats certainly helpful.
That post looks like it has everything I need
What if I already have a webhook in HA. Can I leverage that web hook for Node Red using this?
If so how? Since it looks like the Webhook node creates one. How do I use existing?
Can this part be dynamic?
entity node.
Use case is that I want a few sensors with similar names and the message to say where to place the data.
So something like "entity_{{ number }}"
.
I could place a switch node and send the message to one of x number of entity nodes but this would be much nicer.
How do I set the attributes using input?
[{"id":"f13a1458.268878","type":"function","z":"94bc1df0.962d9","name":"","func":"\nmsg.payload = \"test\";\nmsg.attributes = {\"media_position\": 1, \"vardagsrum\":2}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":980,"y":2980,"wires":[["d89e397.c4012c8","9b850d6b.479c9"]]},{"id":"d9081699.4a0ee8","type":"inject","z":"94bc1df0.962d9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"str","x":850,"y":2920,"wires":[["f13a1458.268878"]]},{"id":"d89e397.c4012c8","type":"ha-entity","z":"94bc1df0.962d9","name":"last_watched_2","server":"4bbca37b.1700ec","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"last_watched_2"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":1140,"y":3060,"wires":[[]]},{"id":"9b850d6b.479c9","type":"debug","z":"94bc1df0.962d9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1130,"y":2980,"wires":[]},{"id":"4bbca37b.1700ec","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
This sets the state to test, but the attributes are not changed.
never mind, I figured it out.
function node:
msg.payload = {"state": "test1",
attributes:{
"media_position": 1, "vardagsrum":2
}
};
return msg;
Just a heads up re a breaking change in the latest updated to this custom component:
As mentioned in the release notes of v1.0.0:
Using attributes for
state_class
andlast_reset
on the entity node will no longer show these properties in Home Assistant. There are now config fields for these properties.
The mentioned new config fields will only appear in your Node Red sensor nodes if you also update contrib node-red-contrib-home-assistant-websocket
in the Node Red palette to v0.40.0:
After that the node dialogs change and you can move your attributes to the new fields.
Here is an example:
OLD:
NEW: