Allow switches to be represented as outlets on google assistant (#23149)
* Add device class support for switch to support outlet type * Add a test for cover device class sync * Drop remnant unused import
This commit is contained in:
1 parent
e02a5f0b31
commit
1bfccd803f
5 files changed
+70
-1
No files matched your search
@@ -33,6 +33,16 @@ PROP_TO_ATTR = {
|
||||
'today_energy_kwh': ATTR_TODAY_ENERGY_KWH,
|
||||
}
|
||||
|
||||
DEVICE_CLASS_OUTLET = 'outlet'
|
||||
DEVICE_CLASS_SWITCH = 'switch'
|
||||
|
||||
DEVICE_CLASSES = [
|
||||
DEVICE_CLASS_OUTLET,
|
||||
DEVICE_CLASS_SWITCH,
|
||||
]
|
||||
|
||||
DEVICE_CLASSES_SCHEMA = vol.All(vol.Lower, vol.In(DEVICE_CLASSES))
|
||||
|
||||
SWITCH_SERVICE_SCHEMA = vol.Schema({
|
||||
vol.Optional(ATTR_ENTITY_ID): cv.comp_entity_ids,
|
||||
})
|
||||
@@ -113,3 +123,8 @@ class SwitchDevice(ToggleEntity):
|
||||
data[attr] = value
|
||||
|
||||
return data
|
||||
|
||||
@property
|
||||
def device_class(self):
|
||||
"""Return the class of this device, from component DEVICE_CLASSES."""
|
||||
return None
|
||||
Reference in new issue
Block a user