Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding multiple Shelly BLU TRVs to single Shelly Gateway GEN3 #498

Open
gu-stera opened this issue Oct 23, 2024 · 28 comments
Open

Adding multiple Shelly BLU TRVs to single Shelly Gateway GEN3 #498

gu-stera opened this issue Oct 23, 2024 · 28 comments

Comments

@gu-stera
Copy link

I've added a GW3 to my setup with 2 BLU TRVs connected to it. I see the GW added in MQTT, but the TRVs are not showing up.

Here is my config:

    device_ids:  # enter the list of device IDs (MQTT prefixes) here
      - LR-GW3 # This GW doesn't show the 2 TRVs that are connected to it
      - KTCN-GW3 # This GW shows the TRV that is connected to it
      - BR-GW3 # This GW shows the TRV that is connected to it

All GWs have the same configuration.

@bieniu
Copy link
Owner

bieniu commented Oct 23, 2024

Please fill up the form. I'm not able to help you without any information.

@bieniu bieniu added the needs-more-information Further information is requested label Oct 23, 2024
@gu-stera
Copy link
Author

gu-stera commented Oct 23, 2024

Describe the bug

If there are more than 1 TRVs on the same GW Gen3, none of them are showing up in HA.

Expected behavior
All devices that are added to a single GW Gen3 should show up in HA

Versions:

  • Home Assistant: Home Assistant OS 13.2, supervisor-2024.10.2, core-2024.10.3
  • Shellies Discovery GEN2: 3.2.0
  • Shelly device firmware: 20241021-140344/1.4.99-blugwg3prod4-g110402b
  • 20241011-050134/v1.0.1@ed260994

Shellies Discovery GEN2 automations:

 - id: shellies_announce_gen2
  alias: "Shellies Announce Gen2"
  triggers:
    - platform: homeassistant
      event: start
  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
      - LR-GW3
      - KTCN-GW3
      - BR-GW3
  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 }}"
- 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"

@bieniu
Copy link
Owner

bieniu commented Oct 23, 2024

Debug log?

@gu-stera
Copy link
Author

@bieniu
Copy link
Owner

bieniu commented Oct 23, 2024

Nothing in the log related to LR-GW3.

@gu-stera
Copy link
Author

home-assistant_2024-10-23T19-19-14.157Z.log
this is weird.... please check this log, there are some records on LR-GW3 in it.

@bieniu
Copy link
Owner

bieniu commented Oct 23, 2024

The response to Shelly.GetComponent is paginated and does not contain information about the MQTT component, which makes it impossible to configure devices. This is a limitation of the Shelly firmware and at the moment I have no idea how to solve it.

@bieniu bieniu removed the needs-more-information Further information is requested label Oct 23, 2024
@gu-stera
Copy link
Author

so i guess the workaround until\if Shelly will fix this in their FW is to have 1 TRV per GW, which is nonsense in case there is good coverage of the GW, as it is in my case.

@bieniu many thanks for your quick and excellent support!!

@bieniu
Copy link
Owner

bieniu commented Oct 24, 2024

Unfortunately Shelly won't change the approach. Maybe I can find a workaround. At the moment the only solution is to use one gateway per one TRV.

@Spartacus68
Copy link

Hi all,

multiple BLU H&T are also not working with a single GW, so I guess it is the same issue as it is with the 1TRV

@bieniu
Copy link
Owner

bieniu commented Oct 29, 2024

so I guess it is the same issue as it is with the 1TRV

Life is too short for guessing, show me the log and I'll answer you

@Spartacus68
Copy link

Spartacus68 commented Oct 30, 2024

Hi Maciej,

ja, you´re right! If you want to bring this forward, you need support! Attached you can find the log.

Once the second device is attached to the Shelly device, the first BLU H&T (in my case wk) is also not working anymore in Homassistant. Both BLU H&T (wk and ha) deliver data, as you can see in the screenshot from the mqtt explorer.

image
image

home-assistant_2024-10-30T07-20-02.456Z.log

If you need more details, pls. let me know!
Thanks for support!

@bieniu
Copy link
Owner

bieniu commented Oct 30, 2024

@Spartacus68 Sorry, I commented too quickly. This is actually the same problem. Pagination of response for Shelly.GetComponents.

But I can see that bthomedevice:201 (WK) is configured correctly.

2024-10-30 08:11:57.397 DEBUG (SyncWorker_23) [homeassistant.components.python_script.shellies_discovery_gen2.py] Sending to MQTT broker: homeassistant/sensor/shelly1minig3-5432045e0d14-7cc6b6652bd9-206-temperature/config {"name": "Temperature", "en": "true", "uniq_id": "shelly1minig3-5432045e0d14-7cc6b6652bd9-206-temperature", "qos": 0, "dev": {"cns": [["bluetooth", "7c:c6:b6:65:2b:d9"]], "ids": ["7c:c6:b6:65:2b:d9"], "name": "wk", "mdl": "Shelly BLU H&T", "mdl_id": "SBHT-003C", "mf": "Allterco Robotics", "via_device": "54:32:04:5e:0d:14"}, "o": {"name": "Shellies Discovery Gen2", "sw": "3.3.0", "url": "https://github.com/bieniu/ha-shellies-discovery-gen2"}, "~": "KG_WK_K02/", "avty": [{"t": "~online", "pl_avail": "true", "pl_not_avail": "false"}, {"t": "~status/rpc", "val_tpl": "{%if value_json.mqtt.connected%}online{%else%}offline{%endif%}"}], "val_tpl": "{{value_json.value}}", "stat_t": "~status/bthomesensor:206", "unit_of_meas": "°C", "dev_cla": "temperature", "stat_cla": "measurement", "sug_dsp_prc": 1}
2024-10-30 08:11:57.660 DEBUG (SyncWorker_23) [homeassistant.components.python_script.shellies_discovery_gen2.py] Sending to MQTT broker: homeassistant/sensor/shelly1minig3-5432045e0d14-7cc6b6652bd9-205-humidity/config {"name": "Humidity", "en": "true", "uniq_id": "shelly1minig3-5432045e0d14-7cc6b6652bd9-205-humidity", "qos": 0, "dev": {"cns": [["bluetooth", "7c:c6:b6:65:2b:d9"]], "ids": ["7c:c6:b6:65:2b:d9"], "name": "wk", "mdl": "Shelly BLU H&T", "mdl_id": "SBHT-003C", "mf": "Allterco Robotics", "via_device": "54:32:04:5e:0d:14"}, "o": {"name": "Shellies Discovery Gen2", "sw": "3.3.0", "url": "https://github.com/bieniu/ha-shellies-discovery-gen2"}, "~": "KG_WK_K02/", "avty": [{"t": "~online", "pl_avail": "true", "pl_not_avail": "false"}, {"t": "~status/rpc", "val_tpl": "{%if value_json.mqtt.connected%}online{%else%}offline{%endif%}"}], "val_tpl": "{{value_json.value}}", "stat_t": "~status/bthomesensor:205", "unit_of_meas": "%", "dev_cla": "humidity", "stat_cla": "measurement", "sug_dsp_prc": 1}
2024-10-30 08:11:57.686 DEBUG (SyncWorker_23) [homeassistant.components.python_script.shellies_discovery_gen2.py] Sending to MQTT broker: homeassistant/sensor/shelly1minig3-5432045e0d14-7cc6b6652bd9-201-signal_strength/config {"name": "Signal strength", "en": "true", "uniq_id": "shelly1minig3-5432045e0d14-7cc6b6652bd9-201-signal_strength", "qos": 0, "dev": {"cns": [["bluetooth", "7c:c6:b6:65:2b:d9"]], "ids": ["7c:c6:b6:65:2b:d9"], "name": "wk", "mdl": "Shelly BLU H&T", "mdl_id": "SBHT-003C", "mf": "Allterco Robotics", "via_device": "54:32:04:5e:0d:14"}, "o": {"name": "Shellies Discovery Gen2", "sw": "3.3.0", "url": "https://github.com/bieniu/ha-shellies-discovery-gen2"}, "~": "KG_WK_K02/", "avty": [{"t": "~online", "pl_avail": "true", "pl_not_avail": "false"}, {"t": "~status/rpc", "val_tpl": "{%if value_json.mqtt.connected%}online{%else%}offline{%endif%}"}], "val_tpl": "{{value_json.rssi}}", "stat_t": "~status/bthomedevice:201", "unit_of_meas": "dBm", "dev_cla": "signal_strength", "ent_cat": "diagnostic", "stat_cla": "measurement"}
2024-10-30 08:11:57.705 DEBUG (SyncWorker_23) [homeassistant.components.python_script.shellies_discovery_gen2.py] Sending to MQTT broker: homeassistant/sensor/shelly1minig3-5432045e0d14-7cc6b6652bd9-201-battery/config {"name": "Battery", "en": "true", "uniq_id": "shelly1minig3-5432045e0d14-7cc6b6652bd9-201-battery", "qos": 0, "dev": {"cns": [["bluetooth", "7c:c6:b6:65:2b:d9"]], "ids": ["7c:c6:b6:65:2b:d9"], "name": "wk", "mdl": "Shelly BLU H&T", "mdl_id": "SBHT-003C", "mf": "Allterco Robotics", "via_device": "54:32:04:5e:0d:14"}, "o": {"name": "Shellies Discovery Gen2", "sw": "3.3.0", "url": "https://github.com/bieniu/ha-shellies-discovery-gen2"}, "~": "KG_WK_K02/", "avty": [{"t": "~online", "pl_avail": "true", "pl_not_avail": "false"}, {"t": "~status/rpc", "val_tpl": "{%if value_json.mqtt.connected%}online{%else%}offline{%endif%}"}], "val_tpl": "{{value_json.battery}}", "stat_t": "~status/bthomedevice:201", "unit_of_meas": "%", "dev_cla": "battery", "ent_cat": "diagnostic"}

@Spartacus68
Copy link

ok, then I will not open a new topic. Please. let me know if you need additional support.

The wk is correctley configured, but will not update data anymore.
image
when I remove the BLU H&T from HA, it will also not reconfigured anymore.

@bieniu
Copy link
Owner

bieniu commented Oct 30, 2024

The frequency of data updates has nothing to do with Shellies Discovery. If the MQTT device configuration is correct, then Shellies Discovery has completed its work successfully. The rest is on the Shelly devices side.

when I remove the BLU H&T from HA, it will also not reconfigured anymore.

Show me the log.

@Spartacus68
Copy link

Hi Maciej,

please believe me! HomeAssitant receives no data from the BLU H&T devices if more than one BLU H&T is configured on the shelly. I checked this by pressing the button on the BLU H&T. In the mqtt Explorer, I can see, that the data are sent out when I press the button on the BLU H&T. But in HA still the outdoated data are avaulable. HA does not receive it.

If I remove all BLU H&T from the shelly and if I reconfigure only one BLU H&T on the shelly device, HA receives the data.

@bieniu
Copy link
Owner

bieniu commented Oct 30, 2024

I believe you but I will repeat it once again Shellies Discovery has nothing to do with data transfer between the device and HA. The device itself, BLU gateway, MQTT broker and MQTT integration are responsible for this. The log shows the correct device configuration that matches what is in your MQTT broker so from my point of view the script works.

This issue concerns the inability to configure more than one BLU device for one gateway and let's stay on this topic. Discussing other issues here is pointless.

@bieniu
Copy link
Owner

bieniu commented Nov 11, 2024

Could someone with multiple BLU TRV paired with one gateway show me the response to:

http://GATEWAY_IP/rpc/Shelly.GetComponents?include=["config"]

@Spartacus68
Copy link

Hi,
is this what you need? This Shelly works with two BLU H&T Devices with the shelly integration. At the moment I do not have two BLU H&T with you mqtt integration. If this is needed, pls. let me know.

{
    "components": [
        {
            "key": "ble",
            "config": {
                "enable": true,
                "rpc": {
                    "enable": true
                },
                "observer": {
                    "enable": true
                }
            }
        },
        {
            "key": "bthome",
            "config": {}
        },
        {
            "key": "bthomedevice:200",
            "config": {
                "id": 200,
                "addr": "38:39:8f:7c:de:4a",
                "name": "GH_out",
                "key": null,
                "meta": {
                    "ui": {
                        "view": "regular",
                        "local_name": "SBHT-003C",
                        "icon": null
                    }
                }
            }
        },
        {
            "key": "bthomedevice:201",
            "config": {
                "id": 201,
                "addr": "b0:c7:de:04:22:0e",
                "name": "GH_in",
                "key": null,
                "meta": {
                    "ui": {
                        "view": "regular",
                        "local_name": "SBHT-003C",
                        "icon": ""
                    }
                }
            }
        },
        {
            "key": "bthomesensor:200",
            "config": {
                "id": 200,
                "addr": "38:39:8f:7c:de:4a",
                "name": "bat",
                "obj_id": 1,
                "idx": 0,
                "meta": {
                    "ui": {
                        "icon": ""
                    }
                }
            }
        },
        {
            "key": "bthomesensor:201",
            "config": {
                "id": 201,
                "addr": "38:39:8f:7c:de:4a",
                "name": "h",
                "obj_id": 46,
                "idx": 0,
                "meta": {
                    "ui": {
                        "icon": null
                    }
                }
            }
        },
        {
            "key": "bthomesensor:202",
            "config": {
                "id": 202,
                "addr": "38:39:8f:7c:de:4a",
                "name": "t",
                "obj_id": 69,
                "idx": 0,
                "meta": {
                    "ui": {
                        "icon": ""
                    }
                }
            }
        },
        {
            "key": "bthomesensor:203",
            "config": {
                "id": 203,
                "addr": "b0:c7:de:04:22:0e",
                "name": "bat",
                "obj_id": 1,
                "idx": 0,
                "meta": {
                    "ui": {
                        "icon": null
                    }
                }
            }
        },
        {
            "key": "bthomesensor:204",
            "config": {
                "id": 204,
                "addr": "b0:c7:de:04:22:0e",
                "name": "h",
                "obj_id": 46,
                "idx": 0,
                "meta": {
                    "ui": {
                        "icon": null
                    }
                }
            }
        },
        {
            "key": "bthomesensor:205",
            "config": {
                "id": 205,
                "addr": "b0:c7:de:04:22:0e",
                "name": "t",
                "obj_id": 69,
                "idx": 0,
                "meta": {
                    "ui": {
                        "icon": null
                    }
                }
            }
        },
        {
            "key": "cloud",
            "config": {
                "enable": false,
                "server": "iot.shelly.cloud:6012/jrpc"
            }
        },
        {
            "key": "input:0",
            "config": {
                "id": 0,
                "name": "E0",
                "type": "switch",
                "enable": true,
                "invert": false,
                "factory_reset": true
            }
        },
        {
            "key": "knx",
            "config": {
                "enable": false,
                "ia": "15.15.255",
                "routing": {
                    "addr": "224.0.23.12:3671"
                }
            }
        },
        {
            "key": "mqtt",
            "config": {
                "enable": false,
                "server": "mosquitto.home.schettner.de:8883",
                "client_id": "GH_K01",
                "user": "mqttService",
                "ssl_ca": "user_ca.pem",
                "topic_prefix": "GH_K01",
                "rpc_ntf": true,
                "status_ntf": true,
                "use_client_cert": false,
                "enable_rpc": true,
                "enable_control": true
            }
        },
        {
            "key": "script:1",
            "config": {
                "id": 1,
                "name": "shellies_discovery_gen2_script_20240216",
                "enable": false
            }
        },
        {
            "key": "script:3",
            "config": {
                "id": 3,
                "name": "BLU2MQTT",
                "enable": false
            }
        },
        {
            "key": "script:2",
            "config": {
                "id": 2,
                "name": "aioshelly_ble_integration",
                "enable": false
            }
        }
    ],
    "cfg_rev": 60,
    "offset": 0,
    "total": 21
}

@bieniu
Copy link
Owner

bieniu commented Nov 11, 2024

Could you also show me the output for:

http://GATEWAY_IP/rpc/Shelly.GetComponents

@Spartacus68
Copy link

{
    "components": [
        {
            "key": "ble",
            "status": {},
            "config": {
                "enable": true,
                "rpc": {
                    "enable": true
                },
                "observer": {
                    "enable": true
                }
            }
        },
        {
            "key": "bthome",
            "status": {},
            "config": {}
        },
        {
            "key": "bthomedevice:200",
            "status": {
                "id": 200,
                "rssi": -87,
                "battery": 100,
                "packet_id": 4,
                "last_updated_ts": 1731320375
            },
            "config": {
                "id": 200,
                "addr": "38:39:8f:7c:de:4a",
                "name": "GH_out",
                "key": null,
                "meta": {
                    "ui": {
                        "view": "regular",
                        "local_name": "SBHT-003C",
                        "icon": null
                    }
                }
            }
        },
        {
            "key": "bthomedevice:201",
            "status": {
                "id": 201,
                "rssi": -43,
                "battery": 100,
                "packet_id": 11,
                "last_updated_ts": 1731320390
            },
            "config": {
                "id": 201,
                "addr": "b0:c7:de:04:22:0e",
                "name": "GH_in",
                "key": null,
                "meta": {
                    "ui": {
                        "view": "regular",
                        "local_name": "SBHT-003C",
                        "icon": ""
                    }
                }
            }
        },
        {
            "key": "bthomesensor:200",
            "status": {
                "id": 200,
                "value": 100,
                "last_updated_ts": 1731320375
            },
            "config": {
                "id": 200,
                "addr": "38:39:8f:7c:de:4a",
                "name": "bat",
                "obj_id": 1,
                "idx": 0,
                "meta": {
                    "ui": {
                        "icon": ""
                    }
                }
            }
        },
        {
            "key": "bthomesensor:201",
            "status": {
                "id": 201,
                "value": 98,
                "last_updated_ts": 1731320375
            },
            "config": {
                "id": 201,
                "addr": "38:39:8f:7c:de:4a",
                "name": "h",
                "obj_id": 46,
                "idx": 0,
                "meta": {
                    "ui": {
                        "icon": null
                    }
                }
            }
        },
        {
            "key": "bthomesensor:202",
            "status": {
                "id": 202,
                "value": 8.7,
                "last_updated_ts": 1731320375
            },
            "config": {
                "id": 202,
                "addr": "38:39:8f:7c:de:4a",
                "name": "t",
                "obj_id": 69,
                "idx": 0,
                "meta": {
                    "ui": {
                        "icon": ""
                    }
                }
            }
        },
        {
            "key": "bthomesensor:203",
            "status": {
                "id": 203,
                "value": 100,
                "last_updated_ts": 1731320390
            },
            "config": {
                "id": 203,
                "addr": "b0:c7:de:04:22:0e",
                "name": "bat",
                "obj_id": 1,
                "idx": 0,
                "meta": {
                    "ui": {
                        "icon": null
                    }
                }
            }
        },
        {
            "key": "bthomesensor:204",
            "status": {
                "id": 204,
                "value": 80,
                "last_updated_ts": 1731320390
            },
            "config": {
                "id": 204,
                "addr": "b0:c7:de:04:22:0e",
                "name": "h",
                "obj_id": 46,
                "idx": 0,
                "meta": {
                    "ui": {
                        "icon": null
                    }
                }
            }
        },
        {
            "key": "bthomesensor:205",
            "status": {
                "id": 205,
                "value": 11.2,
                "last_updated_ts": 1731320390
            },
            "config": {
                "id": 205,
                "addr": "b0:c7:de:04:22:0e",
                "name": "t",
                "obj_id": 69,
                "idx": 0,
                "meta": {
                    "ui": {
                        "icon": null
                    }
                }
            }
        },
        {
            "key": "cloud",
            "status": {
                "connected": false
            },
            "config": {
                "enable": false,
                "server": "iot.shelly.cloud:6012/jrpc"
            }
        },
        {
            "key": "input:0",
            "status": {
                "id": 0,
                "state": false
            },
            "config": {
                "id": 0,
                "name": "E0",
                "type": "switch",
                "enable": true,
                "invert": false,
                "factory_reset": true
            }
        }
    ],
    "cfg_rev": 60,
    "offset": 0,
    "total": 21
}

@bieniu
Copy link
Owner

bieniu commented Nov 12, 2024

Please test new shellies_announce_gen2 automation:

# automations.yaml file
- id: shellies_announce_gen2
  alias: "Shellies Announce Gen2"
  triggers:
    - platform: homeassistant
      event: start
  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', 'params': {'include': ['config']}} | to_json }}"
    device_ids:  # enter the list of device IDs (MQTT prefixes) here
      - shellyplus2pm-485519a1ff8c
      - custom-prefix/shelly-kitchen
  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 }}"

@Spartacus68
Copy link

Hi Maciej,

here the setup of the shelly:
image

I can see now the second BLU H&T (ha) in Homeassistant, but it is connected to the first BLU H&T (wk) and not direkcly under the device.
image
image
image

@bieniu
Copy link
Owner

bieniu commented Nov 12, 2024

Debug log please.

@Spartacus68
Copy link

@bieniu
Copy link
Owner

bieniu commented Nov 12, 2024

but it is connected to the first BLU H&T (wk) and not direkcly under the device

Fixed in 3.5.2.

@Spartacus68
Copy link

thank you very much for your support! I am looking forward to download the new version.

@lantuin

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants