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

pull/102303/head
GeoffAtHome 2023-10-19 17:26:34 +01:00 committed by GitHub
parent eab4c24f7f
commit c266583bea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

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)