-
-
Notifications
You must be signed in to change notification settings - Fork 38.2k
Add temperature sensors to the velbus component #16203
New issue
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
Changes from 4 commits
940d92d
3e03916
ef9f4d3
d20c514
39cbe2b
dc09cbe
37f86cb
651a567
d806128
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| """ | ||
| Demo platform that has a couple of fake sensors. | ||
|
|
||
| For more details about this platform, please refer to the documentation | ||
| https://home-assistant.io/components/demo/ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stale link. |
||
| """ | ||
| import logging | ||
|
|
||
| from homeassistant.const import ( | ||
| TEMP_CELSIUS, DEVICE_CLASS_TEMPERATURE) | ||
| from homeassistant.components.velbus import ( | ||
| DOMAIN as VELBUS_DOMAIN, VelbusEntity) | ||
|
|
||
| _LOGGER = logging.getLogger(__name__) | ||
|
|
||
| DEPENDENCIES = ['velbus'] | ||
|
|
||
|
|
||
| async def async_setup_platform(hass, config, async_add_devices, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. expected 2 blank lines, found 1
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename |
||
| discovery_info=None): | ||
| """Set up the Velbus temp sensor platform.""" | ||
| if discovery_info is None: | ||
| return | ||
| sensors = [] | ||
| for sensor in discovery_info: | ||
| module = hass.data[VELBUS_DOMAIN].get_module(sensor[0]) | ||
| channel = sensor[1] | ||
| sensors.append(VelbusTempSensor(module, channel)) | ||
| async_add_devices(sensors, update_before_add=False) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
|
|
||
| class VelbusTempSensor(VelbusEntity): | ||
|
|
||
| @property | ||
| def device_class(self): | ||
| """Return the device class of the sensor.""" | ||
| return DEVICE_CLASS_TEMPERATURE | ||
|
|
||
| @property | ||
| def state(self): | ||
| """Return the state of the sensor.""" | ||
| return self._module._cur | ||
|
|
||
| @property | ||
| def unit_of_measurement(self): | ||
| """Return the unit this state is expressed in.""" | ||
| return TEMP_CELSIUS | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stale docstring.