Add mysensors binary sensor

* Add mysensors binary sensor.
* Add discovery platforms to binary_sensor base component.
* Replace device_state_attributes with state_attributes in
	binary_sensor base class.
* Fix docstrings.
* Add discovery of binary sensor to mysensors component.
* Add child.type as argument to mysensors device_class.
* Move binary sensor types from sensor to binary_sensor module.
* Fix binary_sensor attribute tests. Use state_attributes instead of
	device_state_attributes.
This commit is contained in:
MartinHjelmare 2016-02-20 03:59:06 +01:00
parent 2d0721abe8
commit 08aaea5444
7 changed files with 200 additions and 21 deletions

View file

@ -42,12 +42,14 @@ GATEWAYS = None
DISCOVER_SENSORS = 'mysensors.sensors'
DISCOVER_SWITCHES = 'mysensors.switches'
DISCOVER_LIGHTS = 'mysensors.lights'
DISCOVER_BINARY_SENSORS = 'mysensors.binary_sensor'
# Maps discovered services to their platforms
DISCOVERY_COMPONENTS = [
('sensor', DISCOVER_SENSORS),
('switch', DISCOVER_SWITCHES),
('light', DISCOVER_LIGHTS),
('binary_sensor', DISCOVER_BINARY_SENSORS),
]
@ -148,7 +150,7 @@ def pf_callback_factory(map_sv_types, devices, add_devices, entity_class):
else:
device_class = entity_class
devices[key] = device_class(
gateway, node_id, child.id, name, value_type)
gateway, node_id, child.id, name, value_type, child.type)
_LOGGER.info('Adding new devices: %s', devices[key])
add_devices([devices[key]])