test_ir_remote_sensors.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. def setUp(self):
  12. self.setUpForConfig("ir_remote_sensors.yaml", IR_REMOTE_SENSORS_PAYLOAD)
  13. self.subject = self.entities.get("remote")
  14. self.setUpMultiSensors(
  15. [
  16. {
  17. "dps": TEMP_DP,
  18. "name": "sensor_temperature",
  19. "device_class": SensorDeviceClass.TEMPERATURE,
  20. "unit": UnitOfTemperature.CELSIUS,
  21. "state_class": "measurement",
  22. "testdata": (198, 19.8),
  23. },
  24. {
  25. "dps": HUMID_DP,
  26. "name": "sensor_humidity",
  27. "device_class": SensorDeviceClass.HUMIDITY,
  28. "unit": PERCENTAGE,
  29. "state_class": "measurement",
  30. },
  31. ]
  32. )
  33. # TODO: overcome issues with the HA Store in unit tests.
  34. # async def test_send_command(self):
  35. # async with assert_device_properties_set(
  36. # self.subject._device,
  37. # {IRSEND_DP: '{"control": "send_ir", "head": "", "key1": "1testbutton", "type": 0, "delay": 300}'},
  38. # ):
  39. # await self.subject.async_send_command("b64:testbutton")