|
24 | 24 |
|
25 | 25 | from . import ( |
26 | 26 | CIRCULATOR_FAN_SERVICE_INFO, |
| 27 | + CLIMATE_PANEL_SERVICE_INFO, |
27 | 28 | EVAPORATIVE_HUMIDIFIER_SERVICE_INFO, |
28 | 29 | HUB3_SERVICE_INFO, |
29 | 30 | HUBMINI_MATTER_SERVICE_INFO, |
@@ -728,3 +729,66 @@ async def test_relay_switch_2pm_sensor(hass: HomeAssistant) -> None: |
728 | 729 |
|
729 | 730 | assert await hass.config_entries.async_unload(entry.entry_id) |
730 | 731 | await hass.async_block_till_done() |
| 732 | + |
| 733 | + |
| 734 | +@pytest.mark.usefixtures("entity_registry_enabled_by_default") |
| 735 | +async def test_climate_panel_sensor(hass: HomeAssistant) -> None: |
| 736 | + """Test setting up creates the sensor for Climate Panel.""" |
| 737 | + await async_setup_component(hass, DOMAIN, {}) |
| 738 | + inject_bluetooth_service_info(hass, CLIMATE_PANEL_SERVICE_INFO) |
| 739 | + |
| 740 | + entry = MockConfigEntry( |
| 741 | + domain=DOMAIN, |
| 742 | + data={ |
| 743 | + CONF_ADDRESS: "AA:BB:CC:DD:EE:FF", |
| 744 | + CONF_NAME: "test-name", |
| 745 | + CONF_SENSOR_TYPE: "climate_panel", |
| 746 | + }, |
| 747 | + unique_id="aabbccddeeff", |
| 748 | + ) |
| 749 | + entry.add_to_hass(hass) |
| 750 | + |
| 751 | + assert await hass.config_entries.async_setup(entry.entry_id) |
| 752 | + await hass.async_block_till_done() |
| 753 | + |
| 754 | + assert len(hass.states.async_all("sensor")) == 4 |
| 755 | + assert len(hass.states.async_all("binary_sensor")) == 2 |
| 756 | + |
| 757 | + temperature_sensor = hass.states.get("sensor.test_name_temperature") |
| 758 | + temperature_sensor_attrs = temperature_sensor.attributes |
| 759 | + assert temperature_sensor.state == "26.6" |
| 760 | + assert temperature_sensor_attrs[ATTR_FRIENDLY_NAME] == "test-name Temperature" |
| 761 | + assert temperature_sensor_attrs[ATTR_UNIT_OF_MEASUREMENT] == "°C" |
| 762 | + assert temperature_sensor_attrs[ATTR_STATE_CLASS] == "measurement" |
| 763 | + |
| 764 | + humidity_sensor = hass.states.get("sensor.test_name_humidity") |
| 765 | + humidity_sensor_attrs = humidity_sensor.attributes |
| 766 | + assert humidity_sensor.state == "44" |
| 767 | + assert humidity_sensor_attrs[ATTR_FRIENDLY_NAME] == "test-name Humidity" |
| 768 | + assert humidity_sensor_attrs[ATTR_UNIT_OF_MEASUREMENT] == "%" |
| 769 | + assert humidity_sensor_attrs[ATTR_STATE_CLASS] == "measurement" |
| 770 | + |
| 771 | + rssi_sensor = hass.states.get("sensor.test_name_bluetooth_signal") |
| 772 | + rssi_sensor_attrs = rssi_sensor.attributes |
| 773 | + assert rssi_sensor.state == "-60" |
| 774 | + assert rssi_sensor_attrs[ATTR_FRIENDLY_NAME] == "test-name Bluetooth signal" |
| 775 | + assert rssi_sensor_attrs[ATTR_UNIT_OF_MEASUREMENT] == "dBm" |
| 776 | + |
| 777 | + battery_sensor = hass.states.get("sensor.test_name_battery") |
| 778 | + battery_sensor_attrs = battery_sensor.attributes |
| 779 | + assert battery_sensor.state == "95" |
| 780 | + assert battery_sensor_attrs[ATTR_FRIENDLY_NAME] == "test-name Battery" |
| 781 | + assert battery_sensor_attrs[ATTR_STATE_CLASS] == "measurement" |
| 782 | + |
| 783 | + light_sensor = hass.states.get("binary_sensor.test_name_light") |
| 784 | + light_sensor_attrs = light_sensor.attributes |
| 785 | + assert light_sensor.state == "off" |
| 786 | + assert light_sensor_attrs[ATTR_FRIENDLY_NAME] == "test-name Light" |
| 787 | + |
| 788 | + motion_sensor = hass.states.get("binary_sensor.test_name_motion") |
| 789 | + motion_sensor_attrs = motion_sensor.attributes |
| 790 | + assert motion_sensor.state == "on" |
| 791 | + assert motion_sensor_attrs[ATTR_FRIENDLY_NAME] == "test-name Motion" |
| 792 | + |
| 793 | + assert await hass.config_entries.async_unload(entry.entry_id) |
| 794 | + await hass.async_block_till_done() |
0 commit comments