Closed hlehoux2021 closed 8 months ago
Describe the bug When creating a Text sensor, the topic for the command (Subscriber class) is created under the root topic , without the prefix
To Reproduce Create a Text sensor Look at the config published in homeassistant/text/device-name/sensor-name/config
example: {"component": "text", "device": {"name": "10.0.4.169", "identifiers": ["2225410"]}, "name": "KT", "unique_id": "kt", "max": 255, "min": 0, "mode": "text", "state_topic": "hmd/text/10-0-4-169/KT/state", "json_attributes_topic": "hmd/text/10-0-4-169/KT/attributes", "command_topic": "text/10-0-4-169/KT/command"}
{"component": "text", "device": {"name": "10.0.4.169", "identifiers": ["2225410"]}, "name": "KT", "unique_id": "kt", "max": 255, "min": 0, "mode": "text", "state_topic": "hmd/text/10-0-4-169/KT/state", "json_attributes_topic": "hmd/text/10-0-4-169/KT/attributes", "command_topic": "text/10-0-4-169/KT/command"}
Expected behavior expected config with the same example: {"component": "text", "device": {"name": "10.0.4.169", "identifiers": ["2225410"]}, "name": "KT", "unique_id": "kt", "max": 255, "min": 0, "mode": "text", "state_topic": "hmd/text/10-0-4-169/KT/state", "json_attributes_topic": "hmd/text/10-0-4-169/KT/attributes", "command_topic": "hmd/text/10-0-4-169/KT/command"}
{"component": "text", "device": {"name": "10.0.4.169", "identifiers": ["2225410"]}, "name": "KT", "unique_id": "kt", "max": 255, "min": 0, "mode": "text", "state_topic": "hmd/text/10-0-4-169/KT/state", "json_attributes_topic": "hmd/text/10-0-4-169/KT/attributes", "command_topic": "hmd/text/10-0-4-169/KT/command"}
Desktop (please complete the following information):
Additional context Suggested: in class Subscriber(Discoverable[EntityType]) init
hmd
self._command_topic = f"{self._settings.mqtt.state_prefix}/{self._entity_topic}/command"
Closed by https://github.com/unixorn/ha-mqtt-discoverable/pull/150
Describe the bug When creating a Text sensor, the topic for the command (Subscriber class) is created under the root topic , without the prefix
To Reproduce Create a Text sensor Look at the config published in homeassistant/text/device-name/sensor-name/config
example:
{"component": "text", "device": {"name": "10.0.4.169", "identifiers": ["2225410"]}, "name": "KT", "unique_id": "kt", "max": 255, "min": 0, "mode": "text", "state_topic": "hmd/text/10-0-4-169/KT/state", "json_attributes_topic": "hmd/text/10-0-4-169/KT/attributes", "command_topic": "text/10-0-4-169/KT/command"}
Expected behavior expected config with the same example:
{"component": "text", "device": {"name": "10.0.4.169", "identifiers": ["2225410"]}, "name": "KT", "unique_id": "kt", "max": 255, "min": 0, "mode": "text", "state_topic": "hmd/text/10-0-4-169/KT/state", "json_attributes_topic": "hmd/text/10-0-4-169/KT/attributes", "command_topic": "hmd/text/10-0-4-169/KT/command"}
Desktop (please complete the following information):
Additional context Suggested: in class Subscriber(Discoverable[EntityType]) init
Define the command topic to receive commands from HA, using
hmd
topic prefix