mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 02:07:54 +00:00
Add Siren to Z-Wave.Me integration (#67200)
* Siren integration * Clean up Co-authored-by: Dmitry Vlasov <kerbalspacema@gmail.com> Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
36385396b0
commit
c6952a0ee3
@ -1478,6 +1478,7 @@ omit =
|
|||||||
homeassistant/components/zwave_me/lock.py
|
homeassistant/components/zwave_me/lock.py
|
||||||
homeassistant/components/zwave_me/number.py
|
homeassistant/components/zwave_me/number.py
|
||||||
homeassistant/components/zwave_me/sensor.py
|
homeassistant/components/zwave_me/sensor.py
|
||||||
|
homeassistant/components/zwave_me/siren.py
|
||||||
homeassistant/components/zwave_me/switch.py
|
homeassistant/components/zwave_me/switch.py
|
||||||
|
|
||||||
[report]
|
[report]
|
||||||
|
@ -16,6 +16,7 @@ class ZWaveMePlatform(StrEnum):
|
|||||||
NUMBER = "switchMultilevel"
|
NUMBER = "switchMultilevel"
|
||||||
SWITCH = "switchBinary"
|
SWITCH = "switchBinary"
|
||||||
SENSOR = "sensorMultilevel"
|
SENSOR = "sensorMultilevel"
|
||||||
|
SIREN = "siren"
|
||||||
RGBW_LIGHT = "switchRGBW"
|
RGBW_LIGHT = "switchRGBW"
|
||||||
RGB_LIGHT = "switchRGB"
|
RGB_LIGHT = "switchRGB"
|
||||||
|
|
||||||
@ -28,5 +29,6 @@ PLATFORMS = [
|
|||||||
Platform.LOCK,
|
Platform.LOCK,
|
||||||
Platform.NUMBER,
|
Platform.NUMBER,
|
||||||
Platform.SENSOR,
|
Platform.SENSOR,
|
||||||
|
Platform.SIREN,
|
||||||
Platform.SWITCH,
|
Platform.SWITCH,
|
||||||
]
|
]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/zwave_me",
|
"documentation": "https://www.home-assistant.io/integrations/zwave_me",
|
||||||
"iot_class": "local_push",
|
"iot_class": "local_push",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"zwave_me_ws==0.2.1",
|
"zwave_me_ws==0.2.2",
|
||||||
"url-normalize==1.4.1"
|
"url-normalize==1.4.1"
|
||||||
],
|
],
|
||||||
"after_dependencies": ["zeroconf"],
|
"after_dependencies": ["zeroconf"],
|
||||||
|
49
homeassistant/components/zwave_me/siren.py
Normal file
49
homeassistant/components/zwave_me/siren.py
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
"""Representation of a sirenBinary."""
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from homeassistant.components.siren import SirenEntity
|
||||||
|
from homeassistant.core import callback
|
||||||
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
|
||||||
|
from . import ZWaveMeEntity
|
||||||
|
from .const import DOMAIN, ZWaveMePlatform
|
||||||
|
|
||||||
|
DEVICE_NAME = ZWaveMePlatform.SIREN
|
||||||
|
|
||||||
|
|
||||||
|
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
|
"""Set up the siren platform."""
|
||||||
|
|
||||||
|
@callback
|
||||||
|
def add_new_device(new_device):
|
||||||
|
controller = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
|
siren = ZWaveMeSiren(controller, new_device)
|
||||||
|
|
||||||
|
async_add_entities(
|
||||||
|
[
|
||||||
|
siren,
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
config_entry.async_on_unload(
|
||||||
|
async_dispatcher_connect(
|
||||||
|
hass, f"ZWAVE_ME_NEW_{DEVICE_NAME.upper()}", add_new_device
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ZWaveMeSiren(ZWaveMeEntity, SirenEntity):
|
||||||
|
"""Representation of a ZWaveMe siren."""
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_on(self) -> bool:
|
||||||
|
"""Return the state of the siren."""
|
||||||
|
return self.device.level == "on"
|
||||||
|
|
||||||
|
def turn_on(self, **kwargs: Any) -> None:
|
||||||
|
"""Turn the entity on."""
|
||||||
|
self.controller.zwave_api.send_command(self.device.id, "on")
|
||||||
|
|
||||||
|
def turn_off(self, **kwargs: Any) -> None:
|
||||||
|
"""Turn the entity off."""
|
||||||
|
self.controller.zwave_api.send_command(self.device.id, "off")
|
@ -2506,4 +2506,4 @@ zm-py==0.5.2
|
|||||||
zwave-js-server-python==0.35.2
|
zwave-js-server-python==0.35.2
|
||||||
|
|
||||||
# homeassistant.components.zwave_me
|
# homeassistant.components.zwave_me
|
||||||
zwave_me_ws==0.2.1
|
zwave_me_ws==0.2.2
|
||||||
|
@ -1599,4 +1599,4 @@ zigpy==0.43.0
|
|||||||
zwave-js-server-python==0.35.2
|
zwave-js-server-python==0.35.2
|
||||||
|
|
||||||
# homeassistant.components.zwave_me
|
# homeassistant.components.zwave_me
|
||||||
zwave_me_ws==0.2.1
|
zwave_me_ws==0.2.2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user