Skip to content

Commit

Permalink
Fix via_device value for DeviceInfo (#519)
Browse files Browse the repository at this point in the history
* Fix via_device

* Bump version
  • Loading branch information
bieniu authored Nov 12, 2024
1 parent 6c712b2 commit 241d0ed
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python_scripts/shellies_discovery_gen2.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""This script adds MQTT discovery support for Shellies Gen2 devices."""

VERSION = "3.5.1"
VERSION = "3.5.2"

ATTR_BATTERY_POWERED = "battery_powered"
ATTR_BINARY_SENSORS = "binary_sensors"
Expand Down Expand Up @@ -4225,6 +4225,8 @@ def remove_old_script_versions(device_topic, script_topic):

config_data = {}

via_device = format_mac(device_id.rsplit("-", 1)[-1])

for device, config in bthome_devices.items():
btdevice_id = device.split(":")[-1]
if f"blutrv:{btdevice_id}" in blutrv_devices:
Expand All @@ -4247,7 +4249,6 @@ def remove_old_script_versions(device_topic, script_topic):
logger.debug("Found BTHome devices: %s", bthome_devices) # noqa: F821

mac = config["addr"].lower()
via_device = format_mac(device_id.rsplit("-", 1)[-1])
device_name = config["name"] or SUPPORTED_MODELS[model][ATTR_NAME]
device_id += f"-{mac.replace(":", "")}"
device_info = {
Expand Down Expand Up @@ -4290,7 +4291,6 @@ def remove_old_script_versions(device_topic, script_topic):
for thermostat, config in blutrv_devices.items():
model = MODEL_BLU_TRV
mac = config["addr"].lower()
via_device = format_mac(device_id.rsplit("-", 1)[-1])
device_name = config["name"] or SUPPORTED_MODELS[model][ATTR_NAME]
device_id += f"-{mac.replace(":", "")}"
device_info = {
Expand Down

0 comments on commit 241d0ed

Please sign in to comment.