예제 #1
0
    def test_sensor_off(self):
        """Test setting the state with a template."""
        data = command_line.CommandSensorData(self.hass, 'echo 0', 15)

        entity = command_line.CommandBinarySensor(self.hass, data, 'test',
                                                  None, '1', '0', None)
        entity.update()
        assert STATE_OFF == entity.state
예제 #2
0
    def test_sensor_off(self):
        """Test setting the state with a template."""
        data = command_line.CommandSensorData('echo 0')

        entity = command_line.CommandBinarySensor(self.hass, data, 'test',
                                                  None, '1', '0', None)

        self.assertEqual(STATE_OFF, entity.state)
예제 #3
0
    def test_template(self):
        """ Test command sensor with template """
        data = command_line.CommandSensorData('echo 10')

        entity = command_line.CommandBinarySensor(
            self.hass, data, 'test', '1.0', '0', '{{ value | multiply(0.1) }}')

        self.assertEqual(STATE_ON, entity.state)
예제 #4
0
    def test_template(self):
        """Test setting the state with a template."""
        data = command_line.CommandSensorData(self.hass, 'echo 10', 15)

        entity = command_line.CommandBinarySensor(
            self.hass, data, 'test', None, '1.0', '0',
            template.Template('{{ value | multiply(0.1) }}', self.hass))
        entity.update()
        assert STATE_ON == entity.state