test_ir_remote_sensors.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. from homeassistant.components.sensor import SensorDeviceClass
  2. from homeassistant.const import PERCENTAGE, UnitOfTemperature
  3. from ..const import IR_REMOTE_SENSORS_PAYLOAD
  4. from ..mixins.sensor import MultiSensorTests
  5. from .base_device_tests import TuyaDeviceTestCase
  6. TEMP_DP = "101"
  7. HUMID_DP = "102"
  8. IRSEND_DP = "201"
  9. IRRECV_DP = "202"
  10. class TestIRRemoteSensors(MultiSensorTests, TuyaDeviceTestCase):
  11. __test__ = True
  12. def setUp(self):
  13. self.setUpForConfig("ir_remote_sensors.yaml", IR_REMOTE_SENSORS_PAYLOAD)
  14. self.subject = self.entities.get("remote")
  15. self.setUpMultiSensors(
  16. [
  17. {
  18. "dps": TEMP_DP,
  19. "name": "sensor_temperature",
  20. "device_class": SensorDeviceClass.TEMPERATURE,
  21. "unit": UnitOfTemperature.CELSIUS,
  22. "state_class": "measurement",
  23. "testdata": (198, 19.8),
  24. },
  25. {
  26. "dps": HUMID_DP,
  27. "name": "sensor_humidity",
  28. "device_class": SensorDeviceClass.HUMIDITY,
  29. "unit": PERCENTAGE,
  30. "state_class": "measurement",
  31. },
  32. ]
  33. )
  34. # TODO: overcome issues with the HA Store in unit tests.
  35. # async def test_send_command(self):
  36. # async with assert_device_properties_set(
  37. # self.subject._device,
  38. # {IRSEND_DP: '{"control": "send_ir", "head": "", "key1": "1testbutton", "type": 0, "delay": 300}'},
  39. # ):
  40. # await self.subject.async_send_command("b64:testbutton")