Added a Taps Aff binary sensor#7880
Conversation
|
@bazwilliams, thanks for your PR! By analyzing the history of the files in this pull request, we identified @balloob, @fabaff and @robbiet480 to be potential reviewers. |
| """Return true if taps aff.""" | ||
| return self._is_taps_aff | ||
|
|
||
| @Throttle(MIN_TIME_BETWEEN_UPDATES) |
There was a problem hiding this comment.
Not needed when going with SCAN_INTERVAL.
|
|
||
| DEFAULT_NAME = 'Taps Aff' | ||
|
|
||
| MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=30) |
| import (BinarySensorDevice, PLATFORM_SCHEMA) | ||
| from homeassistant.const import (CONF_NAME) | ||
| import homeassistant.helpers.config_validation as cv | ||
| from homeassistant.util import Throttle |
There was a problem hiding this comment.
Not needed when going with SCAN_INTERVAL.
There was a problem hiding this comment.
I've moved to SCAN_INTERVAL will use this for future sensors.
| import voluptuous as vol | ||
|
|
||
| from homeassistant.components.binary_sensor \ | ||
| import (BinarySensorDevice, PLATFORM_SCHEMA) |
There was a problem hiding this comment.
The \ is not needed if the line break is moved.
from homeassistant.components.binary_sensor import (
BinarySensorDevice, ...)| name = config.get(CONF_NAME) | ||
| location = config.get(CONF_LOCATION) | ||
|
|
||
| taps_aff_data = TapsAffData(location) |
There was a problem hiding this comment.
I guess that there will be an exception if the location is not available. For users it will be helpful if there is a log entry that indicate this. Make the setup return if the location is not present this will ensure that the users are not having a non-functional platform for their instance.
There was a problem hiding this comment.
An exception is thrown, but I've improved the base library as I found a case where an exception slipped through. I've caught RuntimeException and provide a log message to explain what is wrong.
Description:
This adds a binary sensor using the 'tapsaff.co.uk' service to indicate whether it is 'taps aff' in a specified location.
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#2746
Example entry for
configuration.yaml(if applicable):Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
toxrun successfully. Your PR cannot be merged unless tests passREQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.