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:
parent
2d0721abe8
commit
08aaea5444
7 changed files with 200 additions and 21 deletions
|
@ -11,7 +11,10 @@ from homeassistant.const import STATE_ON, STATE_OFF
|
|||
|
||||
|
||||
class TestBinarySensor(unittest.TestCase):
|
||||
"""Test the binary_sensor base class."""
|
||||
|
||||
def test_state(self):
|
||||
"""Test binary sensor state."""
|
||||
sensor = binary_sensor.BinarySensorDevice()
|
||||
self.assertEqual(STATE_OFF, sensor.state)
|
||||
with mock.patch('homeassistant.components.binary_sensor.'
|
||||
|
@ -26,11 +29,12 @@ class TestBinarySensor(unittest.TestCase):
|
|||
binary_sensor.BinarySensorDevice().state)
|
||||
|
||||
def test_attributes(self):
|
||||
"""Test binary sensor attributes."""
|
||||
sensor = binary_sensor.BinarySensorDevice()
|
||||
self.assertEqual({'sensor_class': None},
|
||||
sensor.device_state_attributes)
|
||||
sensor.state_attributes)
|
||||
with mock.patch('homeassistant.components.binary_sensor.'
|
||||
'BinarySensorDevice.sensor_class',
|
||||
new='motion'):
|
||||
self.assertEqual({'sensor_class': 'motion'},
|
||||
sensor.device_state_attributes)
|
||||
sensor.state_attributes)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue