Shelly: fix for RGB devices (#41841)

This commit is contained in:
Simone Chemelli 2020-10-14 21:09:03 +02:00 committed by GitHub
parent 2b1fc90de7
commit 70eebc7211
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,7 +28,7 @@ def shelly_naming(self, block, entity_type: str):
return f"{entity_name} {self.description.name}" return f"{entity_name} {self.description.name}"
channels = 0 channels = 0
mode = "relays" mode = block.type + "s"
if "num_outputs" in self.wrapper.device.shelly: if "num_outputs" in self.wrapper.device.shelly:
channels = self.wrapper.device.shelly["num_outputs"] channels = self.wrapper.device.shelly["num_outputs"]
if ( if (
@ -38,7 +38,6 @@ def shelly_naming(self, block, entity_type: str):
channels = 1 channels = 1
if block.type == "emeter" and "num_emeters" in self.wrapper.device.shelly: if block.type == "emeter" and "num_emeters" in self.wrapper.device.shelly:
channels = self.wrapper.device.shelly["num_emeters"] channels = self.wrapper.device.shelly["num_emeters"]
mode = "emeters"
if channels > 1 and block.type != "device": if channels > 1 and block.type != "device":
# Shelly EM (SHEM) with firmware v1.8.1 doesn't have "name" key; will be fixed in next firmware release # Shelly EM (SHEM) with firmware v1.8.1 doesn't have "name" key; will be fixed in next firmware release
if "name" in self.wrapper.device.settings[mode][int(block.channel)]: if "name" in self.wrapper.device.settings[mode][int(block.channel)]: