I’m writing a script to automatically provision certain parts of Home Assistant. My goal is to be able to reproduce what I can do manually via the UI and zwave > Config but with a script using websocket (and rest-api if not everything is available via the websocket-api).
The problems I have are the following:
- Get the parent zwave-entity for a child entity.
All zwave-entities that belong to the same device seems to have the samedevice_id
EXCEPT the actual zwave device where thedevice_id
is null:
{
"config_entry_id": null,
"device_id": null,
"disabled_by": null,
"entity_id": "zwave.v0_shop_motion",
"name": "Verkstaden r\u00f6relse",
"platform": "zwave"
}, {
"config_entry_id": "7d77955f6c0b4d07aa786bc8125e79fd",
"device_id": "de578d219b024882ae4981e31ab9b4eb",
"disabled_by": null,
"entity_id": "sensor.v0_shop_motion_temperature",
"name": "Verkstaden Eye temperatur",
"platform": "zwave"
}
- Get the type of sensor of a child entity.
When I look at the rest-call made by the web ui it calls/api/zwave/values/<Node ID>
which have the information I look for in thelabel
key. But from the websocket API I can’t find the Node ID to use in the REST-api, and I can’t see a way to associate the child entity results in the websocket result with the child entities in the rest-api call
"72057594479132690": {
"index": 1,
"instance": 1,
"label": "Temperature",
"poll_intensity": 0
}
I do not want to rely on the default entity_id or name for detecting type of child entity but to be sure I wan’t to use whats in the zwave configuration used to populate those fields (I can’t be sure that the entity_id or name haven’t been changed since the adding of the device and me running the script)