-
-
Notifications
You must be signed in to change notification settings - Fork 37.3k
Initial support for Fibaro HomeCenter hubs #17891
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 all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
81f3cd1
Fibaro HC connection, initial commit
pbalogh77 764f7ee
Cover, switch, bugfixes
pbalogh77 488f2ab
Some cleanup and improved lights
pbalogh77 6006e42
Added status updates and actions
pbalogh77 135efe3
Code cleanup, fiblary3 req
pbalogh77 cf0bd41
Included in .coveragerc and added how to use guide
pbalogh77 c5d262d
PyLint inspired fixes
pbalogh77 8d67c03
PyLint inspired fixes
pbalogh77 fd8222c
updated to fiblary3 0.1.5
pbalogh77 e39ca5d
Minor fixes to finally pass pull req
pbalogh77 a1a25ac
module import and flake8 fixes
pbalogh77 b3daaff
Fixed color support for lights, simplified callback
pbalogh77 004a35b
Lean and mean refactor
pbalogh77 f0daffb
Minor fixes to please HoundCI
pbalogh77 e3adfc5
Removed unused component
pbalogh77 24fdf13
Nicer comments.
pbalogh77 873b991
DEVICE_CLASS, ignore plugins, improved mapping
pbalogh77 dbc4f7a
Fixed dimming
pbalogh77 720cfe4
flake8
pbalogh77 f09bd58
Cleanup, Light fixes, switch power
pbalogh77 294bb17
Missing comment added
pbalogh77 b680c55
Removed everything but bin.sensors
pbalogh77 4e4c0bc
better aligned comments
pbalogh77 a801e2a
Fixes based on code review
pbalogh77 0d57aaf
Implemented stopping
pbalogh77 93e6533
Minor fix
pbalogh77 085bc31
Nicer wording on shutdown
pbalogh77 888527f
Minor changes based on code review
pbalogh77 47b0970
minor fixes based on code review
pbalogh77 3f70c44
removed extra line break
pbalogh77 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
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,74 @@ | ||
| """ | ||
| Support for Fibaro binary sensors. | ||
|
|
||
| For more details about this platform, please refer to the documentation at | ||
| https://home-assistant.io/components/binary_sensor.fibaro/ | ||
| """ | ||
| import logging | ||
|
|
||
| from homeassistant.components.binary_sensor import ( | ||
| BinarySensorDevice, ENTITY_ID_FORMAT) | ||
| from homeassistant.components.fibaro import ( | ||
| FIBARO_CONTROLLER, FIBARO_DEVICES, FibaroDevice) | ||
|
|
||
| DEPENDENCIES = ['fibaro'] | ||
|
|
||
| _LOGGER = logging.getLogger(__name__) | ||
|
|
||
| SENSOR_TYPES = { | ||
| 'com.fibaro.doorSensor': ['Door', 'mdi:window-open', 'door'], | ||
| 'com.fibaro.windowSensor': ['Window', 'mdi:window-open', 'window'], | ||
| 'com.fibaro.smokeSensor': ['Smoke', 'mdi:smoking', 'smoke'], | ||
| 'com.fibaro.FGMS001': ['Motion', 'mdi:run', 'motion'], | ||
| 'com.fibaro.heatDetector': ['Heat', 'mdi:fire', 'heat'], | ||
| } | ||
|
|
||
|
|
||
| def setup_platform(hass, config, add_entities, discovery_info=None): | ||
| """Perform the setup for Fibaro controller devices.""" | ||
| if discovery_info is None: | ||
| return | ||
|
|
||
| add_entities( | ||
| [FibaroBinarySensor(device, hass.data[FIBARO_CONTROLLER]) | ||
| for device in hass.data[FIBARO_DEVICES]['binary_sensor']], True) | ||
|
|
||
|
|
||
| class FibaroBinarySensor(FibaroDevice, BinarySensorDevice): | ||
| """Representation of a Fibaro Binary Sensor.""" | ||
|
|
||
| def __init__(self, fibaro_device, controller): | ||
| """Initialize the binary_sensor.""" | ||
| self._state = None | ||
| super().__init__(fibaro_device, controller) | ||
| self.entity_id = ENTITY_ID_FORMAT.format(self.ha_id) | ||
| stype = None | ||
| if fibaro_device.type in SENSOR_TYPES: | ||
| stype = fibaro_device.type | ||
| elif fibaro_device.baseType in SENSOR_TYPES: | ||
| stype = fibaro_device.baseType | ||
| if stype: | ||
| self._device_class = SENSOR_TYPES[stype][2] | ||
| self._icon = SENSOR_TYPES[stype][1] | ||
| else: | ||
| self._device_class = None | ||
| self._icon = None | ||
|
|
||
| @property | ||
| def icon(self): | ||
| """Icon to use in the frontend, if any.""" | ||
| return self._icon | ||
|
|
||
| @property | ||
| def device_class(self): | ||
| """Return the device class of the sensor.""" | ||
| return self._device_class | ||
|
|
||
| @property | ||
| def is_on(self): | ||
| """Return true if sensor is on.""" | ||
| return self._state | ||
|
|
||
| def update(self): | ||
| """Get the latest data and update the state.""" | ||
| self._state = self.current_binary_state | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.