Closed fredrike closed 4 years ago
ACCA5401B5EA-vit_inne
could be created by using slugify just as done here:
https://github.com/home-assistant/core/blob/master/homeassistant/util/__init__.py#L47
i.e.
from slugify import slugify
ident = f"{mac}-{slugify(name, separator='_'}"
@quazzie: your code really looks amazing, I think I might be able to wrap multiple devices together myself..
My idea is to add a helper function for publish_discovery()
that uses via_device (I've even documented it now:https://github.com/home-assistant/home-assistant.io/pull/12671 )
https://github.com/quazzie/tellstick-plugin-mqtt-hass/blob/8b3d33af29b7b3a8a0d242048f04d6ad758d9c19/hass_client/Client.py#L414-L437
What do you think of it?
Thanks! Sorry i have not had time to look at this.
I tried you pr on my dev tellstick, seems to work as you describe. Maybe a problem on HA's end but i think this is a lot more confusing :) I can't see all my tellstick devices in one place, having a hard time finding them all, is it suppose to be like that?
Before i could just go to devices - tellstick and get all my sensors/devices.
The idea is to go to Integrations -> MQTT and there you can see all Devices..
From one Device you should be able to see Entites and parents..
Look at the Related tab (and hopefully there should be a hierarchy).
Could you upload the test version so I can test it?
Do you want me to make this optional via configuration?
This is not right:
homeassistant/<type 'type'>/telldus/hub/config {"availability_topic": "telldus/telldus/available", "name": "telldus", "payload_on": "online", "device": {"sw_version": "1.3.1", "name": "telldus", "identifiers": "ACCA5401B5EA", "connections": [["mac", "AC:CA:54:01:B5:EA"]], "model": "tellstick-znet-lite-v2", "manufacturer": "Telldus Technologies"}, "device_class": "connectivity", "state_topic": "telldus/telldus/available", "payload_off": "offline", "unique_id": "ACCA5401B5EA_hub"}
Hm, the hierarchy does not seem to work either..
MQTT_Homeassistant-0.85.1.zip Fixed <type 'type'> to binary_sensor
I do think this is the intended way Devices should work. There is hierarchy but it is not shown in the frontend (yet).
What do you think about setting Device.protocol().title()
as device.manufacturer
?
Also, the device_name
used in topic must be sluggified according to: https://www.home-assistant.io/docs/mqtt/discovery/ (node_id)
Vi kanske ska skippa min unique_id ändring också, det kommer ju ändra alla devices och bli en "Breaking change" på gamla entiteter.
I've updated the code in my PR..
The way Home-Assistant works with devices is the following:
via_device
property https://github.com/home-assistant/core/pull/19454).That means that in the Telldus environment each sensor should be its own device and this device should be nested under the Tellstick-device.
This is how the sensor "Vit Inne" in the Tellstick-live integration (Mjövik is the name of my Tellstick-Lite):
I therefore suggest that this plugin sends a
binary_sensor
that represents the Tellstick like this:homeassistant/binary_sensor/telldus/ACCA5401B5EA/config
And that this entities (posted to
homeassistant/sensor/telldus/6_1_0/config
,homeassistant/sensor/telldus/6_2_0/config
&homeassistant/sensor/telldus/ACCA5401B5EA_6_battery/config
:Are changed to:
I don't know if "model" & "manufacturer" is available at the plugin level but perhaps "model" could represent the type of device.