I’m new to Home Assistant and am trying to get your script to detect a Shelly H&T. I’ve added the python script and automations. I haven’t added a shellyht argument to the script because, as I understand it, that is no longer needed unless I am misreading the note for version 0.3.0. Otherwise, the script is unmodified.
When I execute Shellies Announce, there are entries in the Mosquitto broker and Home-Assistant log that seem to show that things are happening, but nothing shows up in the MQTT section of Integrations, and there are no entries in Entity Registry.
This is what the Mosquitto Log gives me:
554444124: New connection from 192.168.1.56 on port 1883.
1554444124: |-- mosquitto_auth_unpwd_check(mosquitto)
1554444124: |-- ** checking backend http
1554444124: |-- url=http://127.0.0.1:8080/login
1554444124: |-- data=username=mosquitto&password=XXXXX&topic=&acc=-1&clientid=
[INFO] found mosquitto on Home Assistant
1554444127: |-- getuser(mosquitto) AUTHENTICATED=1 by http
1554444127: New client connected from 192.168.1.56 as shellyht-XXXXXX (c1, k60, u’mosquitto’).
This is what the Home-Assistant log gives me. One thing that jumps out at me is the mac address retrieved from “announce” IS NOT the mac on the Shelly H&T. It is off by one digit. The mac from DHCP begins with CC5 but the mac from announce begins with CE5. Otherwise, they are the same. I don’t know how this is possible, but then again, I don’t know how any of this works. Do you see what is going wrong?
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.1835638608] Received {'type': 'call_service', 'domain': 'automation', 'service': 'trigger', 'service_data': {'entity_id': 'automation.shellies_announce'}, 'id': 82}
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=automation, service=trigger, service_data=entity_id=automation.shellies_announce>
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event automation_triggered[L]: name=Shellies Announce, entity_id=automation.shellies_announce>
2019-04-05 00:04:09 INFO (MainThread) [homeassistant.components.automation] Executing Shellies Announce
2019-04-05 00:04:09 INFO (MainThread) [homeassistant.helpers.script] Script Shellies Announce: Running script
2019-04-05 00:04:09 INFO (MainThread) [homeassistant.helpers.script] Script Shellies Announce: Executing step call service
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=mqtt, service=publish, service_data=payload=announce, topic=shellies/command>
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on shellies/command: announce
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=automation.shellies_announce, old_state=<state automation.shellies_announce=on; last_triggered=2019-04-05T00:02:04.536685-06:00, id=shellies_announce, friendly_name=Shellies Announce @ 2019-04-04T21:47:59.077741-06:00>, new_state=<state automation.shellies_announce=on; last_triggered=2019-04-05T00:04:09.540555-06:00, id=shellies_announce, friendly_name=Shellies Announce @ 2019-04-04T21:47:59.077741-06:00>>
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.1835520464] Sending {'id': 2, 'type': 'event', 'event': <Event state_changed[L]: entity_id=automation.shellies_announce, old_state=<state automation.shellies_announce=on; last_triggered=2019-04-05T00:02:04.536685-06:00, id=shellies_announce, friendly_name=Shellies Announce @ 2019-04-04T21:47:59.077741-06:00>, new_state=<state automation.shellies_announce=on; last_triggered=2019-04-05T00:04:09.540555-06:00, id=shellies_announce, friendly_name=Shellies Announce @ 2019-04-04T21:47:59.077741-06:00>>}
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.1835638608] Sending {'id': 2, 'type': 'event', 'event': <Event state_changed[L]: entity_id=automation.shellies_announce, old_state=<state automation.shellies_announce=on; last_triggered=2019-04-05T00:02:04.536685-06:00, id=shellies_announce, friendly_name=Shellies Announce @ 2019-04-04T21:47:59.077741-06:00>, new_state=<state automation.shellies_announce=on; last_triggered=2019-04-05T00:04:09.540555-06:00, id=shellies_announce, friendly_name=Shellies Announce @ 2019-04-04T21:47:59.077741-06:00>>}
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/announce: b'{"id":"shellyht-XXXXXX","mac":"XXXXXXXXXXXX","ip":"192.168.1.56","new_fw":false, "fw_ver":"20190402-134544/v1.4.9@9be72c7e"}'
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event automation_triggered[L]: name=Shellies Discovery, entity_id=automation.shellies_discovery>
2019-04-05 00:04:09 INFO (MainThread) [homeassistant.components.automation] Executing Shellies Discovery
2019-04-05 00:04:09 INFO (MainThread) [homeassistant.helpers.script] Script Shellies Discovery: Running script
2019-04-05 00:04:09 INFO (MainThread) [homeassistant.helpers.script] Script Shellies Discovery: Executing step call service
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=python_script, service=shellies_discovery, service_data=discovery_prefix=hass, id=shellyht-XXXXXX, mac=XXXXXXXXXXXX, fw_ver=20190402-134544/v1.4.9@9be72c7e, temp_unit=F>
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.1835638608] Sending {'id': 82, 'type': 'result', 'success': True, 'result': None}
2019-04-05 00:04:09 INFO (SyncWorker_17) [homeassistant.components.python_script] Executing shellies_discovery.py: {'discovery_prefix': 'hass', 'id': 'shellyht-XXXXXX', 'mac': 'XXXXXXXXXXXX', 'fw_ver': '20190402-134544/v1.4.9@9be72c7e', 'temp_unit': 'F'}
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=mqtt, service=publish, service_data=topic=hass/sensor/shellyht-XXXXXX-temperature/config, payload={"name":"ShellyH&T XXXXXX Temperature","stat_t":"~sensor/temperature","unit_of_meas":"°F","device_class":"temperature","val_tpl":"{{ value | round(1) }}","avty_t":"~online","pl_avail":"true","pl_not_avail":"false","uniq_id":"shellyht-XXXXXX-temperature","device": {"identifiers": ["XXXXXXXXXXXX"],"name":"ShellyH&T XXXXXX","model":"ShellyH&T","sw_version":"20190402-134544/v1.4.9@9be72c7e","manufacturer":"Shelly"},"~":"shellies/shellyht-XXXXXX/"}, retain=True, qos=0>
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on hass/sensor/shellyht-XXXXXX-temperature/config: {"name":"ShellyH&T XXXXXX Temperature","stat_t":"~sensor/temperature","unit_of_meas":"°F","device_class":"temperature","val_tpl":"{{ value | round(1) }}","avty_t":"~online","pl_avail":"true","pl_not_avail":"false","uniq_id":"shellyht-XXXXXX-temperature","device": {"identifiers": ["XXXXXXXXXXXX"],"name":"ShellyH&T XXXXXX","model":"ShellyH&T","sw_version":"20190402-134544/v1.4.9@9be72c7e","manufacturer":"Shelly"},"~":"shellies/shellyht-XXXXXX/"}
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=mqtt, service=publish, service_data=topic=hass/sensor/shellyht-XXXXXX-humidity/config, payload={"name":"ShellyH&T XXXXXX Humidity","stat_t":"~sensor/humidity","unit_of_meas":"%","device_class":"humidity","val_tpl":"{{ value | round(1) }}","avty_t":"~online","pl_avail":"true","pl_not_avail":"false","uniq_id":"shellyht-XXXXXX-humidity","device": {"identifiers": ["XXXXXXXXXXXX"],"name":"ShellyH&T XXXXXX","model":"ShellyH&T","sw_version":"20190402-134544/v1.4.9@9be72c7e","manufacturer":"Shelly"},"~":"shellies/shellyht-XXXXXX/"}, retain=True, qos=0>
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on hass/sensor/shellyht-XXXXXX-humidity/config: {"name":"ShellyH&T XXXXXX Humidity","stat_t":"~sensor/humidity","unit_of_meas":"%","device_class":"humidity","val_tpl":"{{ value | round(1) }}","avty_t":"~online","pl_avail":"true","pl_not_avail":"false","uniq_id":"shellyht-XXXXXX-humidity","device": {"identifiers": ["XXXXXXXXXXXX"],"name":"ShellyH&T XXXXXX","model":"ShellyH&T","sw_version":"20190402-134544/v1.4.9@9be72c7e","manufacturer":"Shelly"},"~":"shellies/shellyht-XXXXXX/"}
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=mqtt, service=publish, service_data=topic=hass/sensor/shellyht-XXXXXX-battery/config, payload={"name":"ShellyH&T XXXXXX Battery","stat_t":"~sensor/battery","unit_of_meas":"%","device_class":"battery","val_tpl":"{{ value | round }}","avty_t":"~online","pl_avail":"true","pl_not_avail":"false","uniq_id":"shellyht-XXXXXX-battery","device": {"identifiers": ["XXXXXXXXXXXX"],"name":"ShellyH&T XXXXXX","model":"ShellyH&T","sw_version":"20190402-134544/v1.4.9@9be72c7e","manufacturer":"Shelly"},"~":"shellies/shellyht-XXXXXX/"}, retain=True, qos=0>
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on hass/sensor/shellyht-XXXXXX-battery/config: {"name":"ShellyH&T XXXXXX Battery","stat_t":"~sensor/battery","unit_of_meas":"%","device_class":"battery","val_tpl":"{{ value | round }}","avty_t":"~online","pl_avail":"true","pl_not_avail":"false","uniq_id":"shellyht-XXXXXX-battery","device": {"identifiers": ["XXXXXXXXXXXX"],"name":"ShellyH&T XXXXXX","model":"ShellyH&T","sw_version":"20190402-134544/v1.4.9@9be72c7e","manufacturer":"Shelly"},"~":"shellies/shellyht-XXXXXX/"}
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=automation.shellies_discovery, old_state=<state automation.shellies_discovery=on; last_triggered=2019-04-05T00:02:12.031827-06:00, id=shellies_discovery, friendly_name=Shellies Discovery @ 2019-04-04T21:47:59.191797-06:00>, new_state=<state automation.shellies_discovery=on; last_triggered=2019-04-05T00:04:09.802640-06:00, id=shellies_discovery, friendly_name=Shellies Discovery @ 2019-04-04T21:47:59.191797-06:00>>
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.1835520464] Sending {'id': 2, 'type': 'event', 'event': <Event state_changed[L]: entity_id=automation.shellies_discovery, old_state=<state automation.shellies_discovery=on; last_triggered=2019-04-05T00:02:12.031827-06:00, id=shellies_discovery, friendly_name=Shellies Discovery @ 2019-04-04T21:47:59.191797-06:00>, new_state=<state automation.shellies_discovery=on; last_triggered=2019-04-05T00:04:09.802640-06:00, id=shellies_discovery, friendly_name=Shellies Discovery @ 2019-04-04T21:47:59.191797-06:00>>}
2019-04-05 00:04:09 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.1835638608] Sending {'id': 2, 'type': 'event', 'event': <Event state_changed[L]: entity_id=automation.shellies_discovery, old_state=<state automation.shellies_discovery=on; last_triggered=2019-04-05T00:02:12.031827-06:00, id=shellies_discovery, friendly_name=Shellies Discovery @ 2019-04-04T21:47:59.191797-06:00>, new_state=<state automation.shellies_discovery=on; last_triggered=2019-04-05T00:04:09.802640-06:00, id=shellies_discovery, friendly_name=Shellies Discovery @ 2019-04-04T21:47:59.191797-06:00>>}