bieniu / ha-shellies-discovery-gen2

Script that adds MQTT discovery support for Shellies Gen2 devices
Apache License 2.0
107 stars 20 forks source link

H&T Devices are not discovered #504

Closed Spartacus68 closed 1 month ago

Spartacus68 commented 1 month ago

Describe the bug

as metioned, H&T devices are not discovered by the latest update

Expected behavior

automations shellies_announce_gen2 and discoveryGen2 have been updated to the latest version but bthome devices are not present in HA. **Versions:** - Home Assistant: 2024.10.3 - Shellies Discovery GEN2: 3.3.0 - Shelly device firmware: 1.4.4 **Shellies Discovery GEN2 automations:**
id: shellies_discovery_gen2
alias: "Shellies Discovery Gen2"
mode: queued
max: 999
triggers:
  - platform: mqtt
    topic: shellies_discovery/rpc
actions:
  - action: python_script.shellies_discovery_gen2
    data:
      id: "{{ trigger.payload_json.src }}"
      device_config: "{{ trigger.payload_json.result }}"
  - condition: template
    value_template: "{{ 'mqtt' in trigger.payload_json.result }}"
  - service: mqtt.publish
    data:
      topic: "{{ trigger.payload_json.result.mqtt.topic_prefix }}/command"
      payload: "status_update"
id: shellies_announce_gen2
alias: "Shellies Announce Gen2"
triggers:
  - platform: homeassistant
    event: start
actions:
  - repeat:
      for_each: "{{ device_ids }}"
      sequence:
        - action: mqtt.publish
          data:
            topic: "{{ repeat.item }}/rpc"
            payload: "{{ get_config_payload }}"
        - service: mqtt.publish
          data:
            topic: "{{ repeat.item }}/rpc"
            payload: "{{ get_components_payload }}"
variables:
  get_config_payload: "{{ {'id': 1, 'src': 'shellies_discovery', 'method': 'Shelly.GetConfig'} | to_json }}"
  get_components_payload: "{{ {'id': 1, 'src': 'shellies_discovery', 'method':'Shelly.GetComponents'} | to_json }}"
  device_ids:  # enter the list of device IDs (MQTT prefixes) here
    - wc
    - bad

shelly devices bad and wc are discovered by HA correctley, only components are missing. You mentioned in V3.0 the update of automations, and the two files above in the automations.yaml have been updated. What else is necessary and what are you meaning with update automations required if you do net refer to the announceGen and discoveryGen2

bieniu commented 1 month ago

I think you forgot something

image

Spartacus68 commented 1 month ago

sorry! home-assistant_2024-10-25T06-04-07.720Z.log

Device_name is KG_WK_K01. image

bieniu commented 1 month ago

Your BLU H&T doesn't show up correctly, missing model ID (local_name). You probably need to update your device's firmware.

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/python_script/__init__.py", line 270, in execute
    exec(compiled.code, restricted_globals)  # noqa: S102
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "shellies_discovery_gen2.py", line 4155, in <module>
  File "/usr/local/lib/python3.12/site-packages/RestrictedPython/Eval.py", line 28, in default_guarded_getitem
    return ob[index]
           ~~^^^^^^^
KeyError: 'local_name'
Spartacus68 commented 1 month ago

Hi,

the Device Firmware is the latest. I checked a differet BLUE H&T but it is the same. The BLU H&T is working correctly on the shelly integration. Please let me know if you need more details to find the issue. I am using Shelly BLE Debug App under Android.

{
  "info": {
    "id": "XB137192905452505",
    "name": "ShellyBLUHT-7cc6b6652bd9",
    "mac": "7CC6B6652BD9",
    "fwID": "20240408-184609\/v1.0.16@716b307b",
    "gen": "GBLE",
    "code": "SBHT-003C",
    "unixtime": 1729857961,
    "beaconSupported": false,
    "defaultPasskey": "224610"
  },
bieniu commented 1 month ago

I have all the information, issue is on the device side. Response to Shelly.GetComponent must contain local_name or the device will not be configured.

obraz

Also your Shelly 1 mini is not able to recognize the BLU device model.

obraz

Spartacus68 commented 1 month ago

ok, you mean, that the Shelly 1mini Gen3 is the showstopper not the BLUE H&T device! Do you know which Shelly device works correctley? I have several PRO 1PM and PRO1 in place, but I think they will not be able to transmit data from the electrical distribution board via bluetooth as it is a metal cabinet.

bieniu commented 1 month ago

I don't know where exactly the problem is. My BLU HTs present themselves correctly and 2PM Gen3 is a BT gateway for them.

Spartacus68 commented 1 month ago

I do not have other Gen3 Shellies. I will try the PRO 1PM and will reply.

Spartacus68 commented 1 month ago

ok it looks like, that the PRO 1PM is working. I can see the BLU H&T as a connected device. But the button of the H&T is not present, only battery, humidity, temp and signal. I also noticed logbook issues with this device. No data available-

image