-
-
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
940d92d
Added support for velbus temperature sensors
cereal2nd 3e03916
Bumped the required version
cereal2nd ef9f4d3
updated requirements_all.txt
cereal2nd d20c514
Auto review comments fixed
cereal2nd 39cbe2b
Updated after comments
cereal2nd dc09cbe
Updated after comments
cereal2nd 37f86cb
Merge remote-tracking branch 'upstream/dev' into dev
cereal2nd 651a567
Fix travis
cereal2nd d806128
Fix travis
cereal2nd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| """ | ||
| Velbus sensors. | ||
|
|
||
| For more details about this platform, please refer to the documentation | ||
| https://home-assistant.io/components/velbus/ | ||
| """ | ||
| 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_entities, | ||
| 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_entities(sensors) | ||
|
|
||
|
|
||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Url doesn't have correct format. Look at other platforms for the correct format.