Smart plugs appear as Switches and Binary Sensors (#102112)

This commit is contained in:
GeoffAtHome
2023-10-19 17:26:34 +01:00
committed by GitHub
parent eab4c24f7f
commit c266583bea

View File

@@ -9,6 +9,7 @@ from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import DOMAIN, GeniusDevice from . import DOMAIN, GeniusDevice
GH_STATE_ATTR = "outputOnOff" GH_STATE_ATTR = "outputOnOff"
GH_TYPE = "Receiver"
async def async_setup_platform( async def async_setup_platform(
@@ -26,7 +27,7 @@ async def async_setup_platform(
switches = [ switches = [
GeniusBinarySensor(broker, d, GH_STATE_ATTR) GeniusBinarySensor(broker, d, GH_STATE_ATTR)
for d in broker.client.device_objs for d in broker.client.device_objs
if GH_STATE_ATTR in d.data["state"] if GH_TYPE in d.data["type"]
] ]
async_add_entities(switches, update_before_add=True) async_add_entities(switches, update_before_add=True)