def test_temperature_sensor_f(self, mock_function): """Test temperature sensor.""" from pmsensor import co2sensor client = mhz19.MHZClient(co2sensor, 'test.serial') sensor = mhz19.MHZ19Sensor( client, mhz19.SENSOR_TEMPERATURE, TEMP_FAHRENHEIT, 'name') sensor.update() self.assertEqual(75.2, sensor.state)
def test_co2_sensor(self, mock_function): """Test CO2 sensor.""" from pmsensor import co2sensor client = mhz19.MHZClient(co2sensor, 'test.serial') sensor = mhz19.MHZ19Sensor(client, mhz19.SENSOR_CO2, None, 'name') sensor.update() self.assertEqual('name: CO2', sensor.name) self.assertEqual(1000, sensor.state) self.assertEqual('ppm', sensor.unit_of_measurement) self.assertTrue(sensor.should_poll) self.assertEqual({'temperature': 24}, sensor.device_state_attributes)
def test_co2_sensor(self, mock_function): """Test CO2 sensor.""" from pmsensor import co2sensor client = mhz19.MHZClient(co2sensor, 'test.serial') sensor = mhz19.MHZ19Sensor(client, mhz19.SENSOR_CO2, None, 'name') sensor.update() assert 'name: CO2' == sensor.name assert 1000 == sensor.state assert 'ppm' == sensor.unit_of_measurement assert sensor.should_poll assert {'temperature': 24} == sensor.device_state_attributes
def test_temperature_sensor(self, mock_function): """Test temperature sensor.""" from pmsensor import co2sensor client = mhz19.MHZClient(co2sensor, 'test.serial') sensor = mhz19.MHZ19Sensor( client, mhz19.SENSOR_TEMPERATURE, None, 'name') sensor.update() assert 'name: Temperature' == sensor.name assert 24 == sensor.state assert '°C' == sensor.unit_of_measurement assert sensor.should_poll assert {'co2_concentration': 1000} == sensor.device_state_attributes
def test_temperature_sensor(self, mock_function): """Test temperature sensor.""" from pmsensor import co2sensor client = mhz19.MHZClient(co2sensor, 'test.serial') sensor = mhz19.MHZ19Sensor( client, mhz19.SENSOR_TEMPERATURE, None, 'name') sensor.update() self.assertEqual('name: Temperature', sensor.name) self.assertEqual(24, sensor.state) self.assertEqual('°C', sensor.unit_of_measurement) self.assertTrue(sensor.should_poll) self.assertEqual( {'co2_concentration': 1000}, sensor.device_state_attributes)