| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| """Implementation of contact sensor module.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import TYPE_CHECKING | ||
|
|
||
| from ...feature import Feature | ||
| from ..smartmodule import SmartModule | ||
|
|
||
| if TYPE_CHECKING: | ||
| from ..smartdevice import SmartDevice | ||
|
|
||
|
|
||
| class ContactSensor(SmartModule): | ||
| """Implementation of contact sensor module.""" | ||
|
|
||
| REQUIRED_COMPONENT = None # we depend on availability of key | ||
| REQUIRED_KEY_ON_PARENT = "open" | ||
|
|
||
| def __init__(self, device: SmartDevice, module: str): | ||
| super().__init__(device, module) | ||
| self._add_feature( | ||
| Feature( | ||
| device, | ||
| id="is_open", | ||
| name="Open", | ||
| container=self, | ||
| attribute_getter="is_open", | ||
| icon="mdi:door", | ||
|
Comment thread
rytilahti marked this conversation as resolved.
|
||
| category=Feature.Category.Primary, | ||
| type=Feature.Type.BinarySensor, | ||
| ) | ||
| ) | ||
|
|
||
| def query(self) -> dict: | ||
| """Query to execute during the update cycle.""" | ||
| return {} | ||
|
|
||
| @property | ||
| def is_open(self): | ||
| """Return True if the contact sensor is open.""" | ||
| return self._device.sys_info["open"] | ||
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.