test_ir_remote_sensors.py 1.7 KB

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