'Test binary sensor state.'

def test_state(self):

    sensor = binary_sensor.BinarySensorDevice()
    self.assertEqual(STATE_OFF, sensor.state)
    with mock.patch('homeassistant.components.binary_sensor.BinarySensorDevice.is_on', new=False):
        self.assertEqual(STATE_OFF, binary_sensor.BinarySensorDevice().state)
    with mock.patch('homeassistant.components.binary_sensor.BinarySensorDevice.is_on', new=True):
        self.assertEqual(STATE_ON, binary_sensor.BinarySensorDevice().state)
