From 9d0cc80f96cd313d9015ffdd7ea96739b26c3a95 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 21 Oct 2024 12:42:37 +0200 Subject: [PATCH 1/4] Add tests * tests/snapshots/test_init.ambr: * tests/test_init.py: --- tests/snapshots/test_init.ambr | 1503 ++++++++++++++++++++++++++++++++ tests/test_init.py | 93 ++ 2 files changed, 1596 insertions(+) diff --git a/tests/snapshots/test_init.ambr b/tests/snapshots/test_init.ambr index c2abadf..2d156ec 100644 --- a/tests/snapshots/test_init.ambr +++ b/tests/snapshots/test_init.ambr @@ -69846,6 +69846,1509 @@ 'state': '0', }) # --- +# name: test_fanmode[binary_sensor.sala_climatecontrol_is_holiday_mode_active-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'binary_sensor', + 'entity_category': , + 'entity_id': 'binary_sensor.sala_climatecontrol_is_holiday_mode_active', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:information-outline', + 'original_name': 'ClimateControl Is Holiday Mode Active', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'climatecontrol_isholidaymodeactive', + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_climateControl_None_isHolidayModeActive', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[binary_sensor.sala_climatecontrol_is_holiday_mode_active-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Sala ClimateControl Is Holiday Mode Active', + 'icon': 'mdi:information-outline', + }), + 'context': , + 'entity_id': 'binary_sensor.sala_climatecontrol_is_holiday_mode_active', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- +# name: test_fanmode[binary_sensor.sala_climatecontrol_is_in_error_state-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'binary_sensor', + 'entity_category': , + 'entity_id': 'binary_sensor.sala_climatecontrol_is_in_error_state', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:information-outline', + 'original_name': 'ClimateControl Is In Error State', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'climatecontrol_isinerrorstate', + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_climateControl_None_isInErrorState', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[binary_sensor.sala_climatecontrol_is_in_error_state-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'problem', + 'friendly_name': 'Sala ClimateControl Is In Error State', + 'icon': 'mdi:information-outline', + }), + 'context': , + 'entity_id': 'binary_sensor.sala_climatecontrol_is_in_error_state', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- +# name: test_fanmode[binary_sensor.sala_climatecontrol_is_powerful_mode_active-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'binary_sensor', + 'entity_category': , + 'entity_id': 'binary_sensor.sala_climatecontrol_is_powerful_mode_active', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:information-outline', + 'original_name': 'ClimateControl Is Powerful Mode Active', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'climatecontrol_ispowerfulmodeactive', + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_climateControl_None_isPowerfulModeActive', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[binary_sensor.sala_climatecontrol_is_powerful_mode_active-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Sala ClimateControl Is Powerful Mode Active', + 'icon': 'mdi:information-outline', + }), + 'context': , + 'entity_id': 'binary_sensor.sala_climatecontrol_is_powerful_mode_active', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- +# name: test_fanmode[binary_sensor.sala_gateway_is_firmware_update_supported-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'binary_sensor', + 'entity_category': , + 'entity_id': 'binary_sensor.sala_gateway_is_firmware_update_supported', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:information-outline', + 'original_name': 'Gateway Is Firmware Update Supported', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'gateway_isfirmwareupdatesupported', + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_gateway_None_isFirmwareUpdateSupported', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[binary_sensor.sala_gateway_is_firmware_update_supported-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Sala Gateway Is Firmware Update Supported', + 'icon': 'mdi:information-outline', + }), + 'context': , + 'entity_id': 'binary_sensor.sala_gateway_is_firmware_update_supported', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_fanmode[climate.sala_room_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'fan_modes': list([ + 'quiet', + 'auto', + '1', + '2', + '3', + '4', + '5', + ]), + 'hvac_modes': list([ + , + , + , + , + , + , + ]), + 'max_temp': 30, + 'min_temp': 10, + 'preset_modes': list([ + 'away', + 'boost', + 'none', + ]), + 'swing_modes': list([ + 'off', + 'horizontal', + 'vertical', + 'both', + ]), + 'target_temp_step': 0.5, + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'climate', + 'entity_category': None, + 'entity_id': 'climate.sala_room_temperature', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Sala Room Temperature', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': 'daikin_onecta', + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_roomTemperature', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[climate.sala_room_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'current_temperature': 21, + 'fan_mode': 'auto', + 'fan_modes': list([ + 'quiet', + 'auto', + '1', + '2', + '3', + '4', + '5', + ]), + 'friendly_name': 'Sala Room Temperature', + 'hvac_modes': list([ + , + , + , + , + , + , + ]), + 'max_temp': 30, + 'min_temp': 10, + 'preset_mode': 'none', + 'preset_modes': list([ + 'away', + 'boost', + 'none', + ]), + 'supported_features': , + 'swing_mode': 'off', + 'swing_modes': list([ + 'off', + 'horizontal', + 'vertical', + 'both', + ]), + 'target_temp_step': 0.5, + 'temperature': 25, + }), + 'context': , + 'entity_id': 'climate.sala_room_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- +# name: test_fanmode[select.sala_climatecontrol_schedule-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'options': list([ + '0', + '1', + '2', + 'off', + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': None, + 'entity_id': 'select.sala_climatecontrol_schedule', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:calendar-clock', + 'original_name': 'ClimateControl Schedule', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_climateControl_schedule', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[select.sala_climatecontrol_schedule-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Sala ClimateControl Schedule', + 'icon': 'mdi:calendar-clock', + 'options': list([ + '0', + '1', + '2', + 'off', + ]), + }), + 'context': , + 'entity_id': 'select.sala_climatecontrol_schedule', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- +# name: test_fanmode[sensor.sala_climatecontrol_cooling_daily_electrical_consumption-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.sala_climatecontrol_cooling_daily_electrical_consumption', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:snowflake', + 'original_name': 'ClimateControl Cooling Daily Electrical Consumption', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_climateControl_electrical_cooling_d', + 'unit_of_measurement': , + }) +# --- +# name: test_fanmode[sensor.sala_climatecontrol_cooling_daily_electrical_consumption-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'energy', + 'friendly_name': 'Sala ClimateControl Cooling Daily Electrical Consumption', + 'icon': 'mdi:snowflake', + 'state_class': , + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'sensor.sala_climatecontrol_cooling_daily_electrical_consumption', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '0', + }) +# --- +# name: test_fanmode[sensor.sala_climatecontrol_cooling_weekly_electrical_consumption-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.sala_climatecontrol_cooling_weekly_electrical_consumption', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:snowflake', + 'original_name': 'ClimateControl Cooling Weekly Electrical Consumption', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_climateControl_electrical_cooling_w', + 'unit_of_measurement': , + }) +# --- +# name: test_fanmode[sensor.sala_climatecontrol_cooling_weekly_electrical_consumption-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'energy', + 'friendly_name': 'Sala ClimateControl Cooling Weekly Electrical Consumption', + 'icon': 'mdi:snowflake', + 'state_class': , + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'sensor.sala_climatecontrol_cooling_weekly_electrical_consumption', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '0', + }) +# --- +# name: test_fanmode[sensor.sala_climatecontrol_cooling_yearly_electrical_consumption-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.sala_climatecontrol_cooling_yearly_electrical_consumption', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:snowflake', + 'original_name': 'ClimateControl Cooling Yearly Electrical Consumption', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_climateControl_electrical_cooling_m', + 'unit_of_measurement': , + }) +# --- +# name: test_fanmode[sensor.sala_climatecontrol_cooling_yearly_electrical_consumption-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'energy', + 'friendly_name': 'Sala ClimateControl Cooling Yearly Electrical Consumption', + 'icon': 'mdi:snowflake', + 'state_class': , + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'sensor.sala_climatecontrol_cooling_yearly_electrical_consumption', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '26.9', + }) +# --- +# name: test_fanmode[sensor.sala_climatecontrol_error_code-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.sala_climatecontrol_error_code', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:information-outline', + 'original_name': 'ClimateControl Error Code', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'climatecontrol_errorcode', + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_climateControl_None_errorCode', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[sensor.sala_climatecontrol_error_code-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Sala ClimateControl Error Code', + 'icon': 'mdi:information-outline', + }), + 'context': , + 'entity_id': 'sensor.sala_climatecontrol_error_code', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '00', + }) +# --- +# name: test_fanmode[sensor.sala_climatecontrol_heating_daily_electrical_consumption-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.sala_climatecontrol_heating_daily_electrical_consumption', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:fire', + 'original_name': 'ClimateControl Heating Daily Electrical Consumption', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_climateControl_electrical_heating_d', + 'unit_of_measurement': , + }) +# --- +# name: test_fanmode[sensor.sala_climatecontrol_heating_daily_electrical_consumption-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'energy', + 'friendly_name': 'Sala ClimateControl Heating Daily Electrical Consumption', + 'icon': 'mdi:fire', + 'state_class': , + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'sensor.sala_climatecontrol_heating_daily_electrical_consumption', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '0', + }) +# --- +# name: test_fanmode[sensor.sala_climatecontrol_heating_weekly_electrical_consumption-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.sala_climatecontrol_heating_weekly_electrical_consumption', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:fire', + 'original_name': 'ClimateControl Heating Weekly Electrical Consumption', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_climateControl_electrical_heating_w', + 'unit_of_measurement': , + }) +# --- +# name: test_fanmode[sensor.sala_climatecontrol_heating_weekly_electrical_consumption-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'energy', + 'friendly_name': 'Sala ClimateControl Heating Weekly Electrical Consumption', + 'icon': 'mdi:fire', + 'state_class': , + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'sensor.sala_climatecontrol_heating_weekly_electrical_consumption', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '0', + }) +# --- +# name: test_fanmode[sensor.sala_climatecontrol_heating_yearly_electrical_consumption-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.sala_climatecontrol_heating_yearly_electrical_consumption', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:fire', + 'original_name': 'ClimateControl Heating Yearly Electrical Consumption', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_climateControl_electrical_heating_m', + 'unit_of_measurement': , + }) +# --- +# name: test_fanmode[sensor.sala_climatecontrol_heating_yearly_electrical_consumption-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'energy', + 'friendly_name': 'Sala ClimateControl Heating Yearly Electrical Consumption', + 'icon': 'mdi:fire', + 'state_class': , + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'sensor.sala_climatecontrol_heating_yearly_electrical_consumption', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '1.9', + }) +# --- +# name: test_fanmode[sensor.sala_climatecontrol_name-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.sala_climatecontrol_name', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:information-outline', + 'original_name': 'ClimateControl Name', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'climatecontrol_name', + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_climateControl_None_name', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[sensor.sala_climatecontrol_name-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Sala ClimateControl Name', + 'icon': 'mdi:information-outline', + }), + 'context': , + 'entity_id': 'sensor.sala_climatecontrol_name', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'Sala', + }) +# --- +# name: test_fanmode[sensor.sala_climatecontrol_outdoor_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.sala_climatecontrol_outdoor_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': '', + 'original_name': 'ClimateControl Outdoor Temperature', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'climatecontrol_outdoortemperature', + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_climateControl_sensoryData_outdoorTemperature', + 'unit_of_measurement': , + }) +# --- +# name: test_fanmode[sensor.sala_climatecontrol_outdoor_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Sala ClimateControl Outdoor Temperature', + 'icon': '', + 'state_class': , + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'sensor.sala_climatecontrol_outdoor_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '18', + }) +# --- +# name: test_fanmode[sensor.sala_climatecontrol_room_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.sala_climatecontrol_room_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': '', + 'original_name': 'ClimateControl Room Temperature', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'climatecontrol_roomtemperature', + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_climateControl_sensoryData_roomTemperature', + 'unit_of_measurement': , + }) +# --- +# name: test_fanmode[sensor.sala_climatecontrol_room_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Sala ClimateControl Room Temperature', + 'icon': '', + 'state_class': , + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'sensor.sala_climatecontrol_room_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '21', + }) +# --- +# name: test_fanmode[sensor.sala_gateway_firmware_version-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.sala_gateway_firmware_version', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:information-outline', + 'original_name': 'Gateway Firmware Version', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'gateway_firmwareversion', + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_gateway_None_firmwareVersion', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[sensor.sala_gateway_firmware_version-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Sala Gateway Firmware Version', + 'icon': 'mdi:information-outline', + }), + 'context': , + 'entity_id': 'sensor.sala_gateway_firmware_version', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '4_0_3', + }) +# --- +# name: test_fanmode[sensor.sala_gateway_ip_address-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.sala_gateway_ip_address', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:ip-network', + 'original_name': 'Gateway Ip Address', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'gateway_ipaddress', + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_gateway_None_ipAddress', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[sensor.sala_gateway_ip_address-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Sala Gateway Ip Address', + 'icon': 'mdi:ip-network', + }), + 'context': , + 'entity_id': 'sensor.sala_gateway_ip_address', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '192.168.1.2', + }) +# --- +# name: test_fanmode[sensor.sala_gateway_mac_address-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.sala_gateway_mac_address', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:information-outline', + 'original_name': 'Gateway Mac Address', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'gateway_macaddress', + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_gateway_None_macAddress', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[sensor.sala_gateway_mac_address-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Sala Gateway Mac Address', + 'icon': 'mdi:information-outline', + }), + 'context': , + 'entity_id': 'sensor.sala_gateway_mac_address', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'MANUALLY_REMOVED', + }) +# --- +# name: test_fanmode[sensor.sala_gateway_model_info-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.sala_gateway_model_info', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:information-outline', + 'original_name': 'Gateway Model Info', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'gateway_modelinfo', + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_gateway_None_modelInfo', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[sensor.sala_gateway_model_info-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Sala Gateway Model Info', + 'icon': 'mdi:information-outline', + }), + 'context': , + 'entity_id': 'sensor.sala_gateway_model_info', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'BRP069A4x', + }) +# --- +# name: test_fanmode[sensor.sala_gateway_name-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.sala_gateway_name', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:information-outline', + 'original_name': 'Gateway Name', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'gateway_name', + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_gateway_None_name', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[sensor.sala_gateway_name-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Sala Gateway Name', + 'icon': 'mdi:information-outline', + }), + 'context': , + 'entity_id': 'sensor.sala_gateway_name', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'Gateway', + }) +# --- +# name: test_fanmode[sensor.sala_indoorunit_name-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.sala_indoorunit_name', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:information-outline', + 'original_name': 'IndoorUnit Name', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'indoorunit_name', + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_indoorUnit_None_name', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[sensor.sala_indoorunit_name-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Sala IndoorUnit Name', + 'icon': 'mdi:information-outline', + }), + 'context': , + 'entity_id': 'sensor.sala_indoorunit_name', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'Indoor Unit', + }) +# --- +# name: test_fanmode[sensor.sala_indoorunit_software_version-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.sala_indoorunit_software_version', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:information-outline', + 'original_name': 'IndoorUnit Software Version', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'indoorunit_softwareversion', + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_indoorUnit_None_softwareVersion', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[sensor.sala_indoorunit_software_version-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Sala IndoorUnit Software Version', + 'icon': 'mdi:information-outline', + }), + 'context': , + 'entity_id': 'sensor.sala_indoorunit_software_version', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '3.20', + }) +# --- +# name: test_fanmode[sensor.sala_ratelimit_day-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.sala_ratelimit_day', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:information-outline', + 'original_name': 'RateLimit day', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_limitsensor_day', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[sensor.sala_ratelimit_day-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Sala RateLimit day', + 'icon': 'mdi:information-outline', + 'state_class': , + }), + 'context': , + 'entity_id': 'sensor.sala_ratelimit_day', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '0', + }) +# --- +# name: test_fanmode[sensor.sala_ratelimit_minute-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.sala_ratelimit_minute', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:information-outline', + 'original_name': 'RateLimit minute', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_limitsensor_minute', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[sensor.sala_ratelimit_minute-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Sala RateLimit minute', + 'icon': 'mdi:information-outline', + 'state_class': , + }), + 'context': , + 'entity_id': 'sensor.sala_ratelimit_minute', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '0', + }) +# --- +# name: test_fanmode[sensor.sala_ratelimit_ratelimit_reset-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.sala_ratelimit_ratelimit_reset', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:information-outline', + 'original_name': 'RateLimit ratelimit_reset', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_limitsensor_ratelimit_reset', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[sensor.sala_ratelimit_ratelimit_reset-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Sala RateLimit ratelimit_reset', + 'icon': 'mdi:information-outline', + 'state_class': , + }), + 'context': , + 'entity_id': 'sensor.sala_ratelimit_ratelimit_reset', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '0', + }) +# --- +# name: test_fanmode[sensor.sala_ratelimit_remaining_day-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.sala_ratelimit_remaining_day', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:information-outline', + 'original_name': 'RateLimit remaining_day', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_limitsensor_remaining_day', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[sensor.sala_ratelimit_remaining_day-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Sala RateLimit remaining_day', + 'icon': 'mdi:information-outline', + 'state_class': , + }), + 'context': , + 'entity_id': 'sensor.sala_ratelimit_remaining_day', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '0', + }) +# --- +# name: test_fanmode[sensor.sala_ratelimit_remaining_minutes-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.sala_ratelimit_remaining_minutes', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:information-outline', + 'original_name': 'RateLimit remaining_minutes', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_limitsensor_remaining_minutes', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[sensor.sala_ratelimit_remaining_minutes-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Sala RateLimit remaining_minutes', + 'icon': 'mdi:information-outline', + 'state_class': , + }), + 'context': , + 'entity_id': 'sensor.sala_ratelimit_remaining_minutes', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '0', + }) +# --- +# name: test_fanmode[sensor.sala_ratelimit_retry_after-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.sala_ratelimit_retry_after', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': 'mdi:information-outline', + 'original_name': 'RateLimit retry_after', + 'platform': 'daikin_onecta', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '13995b32-fc6e-43ed-918e-5d2b01095ccb_limitsensor_retry_after', + 'unit_of_measurement': None, + }) +# --- +# name: test_fanmode[sensor.sala_ratelimit_retry_after-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Sala RateLimit retry_after', + 'icon': 'mdi:information-outline', + 'state_class': , + }), + 'context': , + 'entity_id': 'sensor.sala_ratelimit_retry_after', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '0', + }) +# --- # name: test_holidaymode[binary_sensor.ndj_climatecontrol_is_holiday_mode_active-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ diff --git a/tests/test_init.py b/tests/test_init.py index fba845c..668dfd8 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -92,6 +92,99 @@ async def test_dry( assert hass.states.get("climate.lounge_room_temperature").state == HVACMode.DRY +@responses.activate +async def test_fanmode( + hass: HomeAssistant, + config_entry: MockConfigEntry, + onecta_auth: AsyncMock, + snapshot: SnapshotAssertion, + entity_registry: er.EntityRegistry, +) -> None: + """Test entities.""" + await snapshot_platform_entities(hass, config_entry, Platform.SENSOR, entity_registry, snapshot, "fanmode") + + with patch( + "custom_components.daikin_onecta.DaikinApi.async_get_access_token", + return_value="XXXXXX", + ): + responses.patch( + DAIKIN_API_URL + + "/v1/gateway-devices/13995b32-fc6e-43ed-918e-5d2b01095ccb/management-points/climateControl/characteristics/temperatureControl", + status=204, + ) + responses.patch( + DAIKIN_API_URL + "/v1/gateway-devices/13995b32-fc6e-43ed-918e-5d2b01095ccb/management-points/climateControl/characteristics/onOffMode", + status=204, + ) + responses.patch( + DAIKIN_API_URL + + "/v1/gateway-devices/13995b32-fc6e-43ed-918e-5d2b01095ccb/management-points/climateControl/characteristics/operationMode", + status=204, + ) + assert hass.states.get("climate.Sala_room_temperature").state == HVACMode.OFF + assert hass.states.get("climate.Sala_room_temperature").attributes["fan_mode"] == "auto" + + await hass.services.async_call( + CLIMATE_DOMAIN, + SERVICE_SET_HVAC_MODE, + {ATTR_ENTITY_ID: "climate.Sala_room_temperature", ATTR_HVAC_MODE: HVACMode.COOL}, + blocking=True, + ) + await hass.async_block_till_done() + assert len(responses.calls) == 2 + + assert hass.states.get("climate.Sala_room_temperature").state == HVACMode.COOL + assert hass.states.get("climate.Sala_room_temperature").attributes["fan_mode"] == "3" + + await hass.services.async_call( + CLIMATE_DOMAIN, + SERVICE_SET_HVAC_MODE, + {ATTR_ENTITY_ID: "climate.Sala_room_temperature", ATTR_HVAC_MODE: HVACMode.DRY}, + blocking=True, + ) + await hass.async_block_till_done() + assert len(responses.calls) == 3 + + assert hass.states.get("climate.Sala_room_temperature").state == HVACMode.DRY + assert hass.states.get("climate.Sala_room_temperature").attributes["fan_mode"] == "auto" + + await hass.services.async_call( + CLIMATE_DOMAIN, + SERVICE_SET_HVAC_MODE, + {ATTR_ENTITY_ID: "climate.Sala_room_temperature", ATTR_HVAC_MODE: HVACMode.COOL}, + blocking=True, + ) + await hass.async_block_till_done() + assert len(responses.calls) == 4 + + assert hass.states.get("climate.Sala_room_temperature").state == HVACMode.COOL + assert hass.states.get("climate.Sala_room_temperature").attributes["fan_mode"] == "3" + + await hass.services.async_call( + CLIMATE_DOMAIN, + SERVICE_SET_HVAC_MODE, + {ATTR_ENTITY_ID: "climate.Sala_room_temperature", ATTR_HVAC_MODE: HVACMode.HEAT}, + blocking=True, + ) + await hass.async_block_till_done() + assert len(responses.calls) == 5 + + assert hass.states.get("climate.Sala_room_temperature").state == HVACMode.HEAT + assert hass.states.get("climate.Sala_room_temperature").attributes["fan_mode"] == "auto" + + await hass.services.async_call( + CLIMATE_DOMAIN, + SERVICE_SET_HVAC_MODE, + {ATTR_ENTITY_ID: "climate.Sala_room_temperature", ATTR_HVAC_MODE: HVACMode.DRY}, + blocking=True, + ) + await hass.async_block_till_done() + assert len(responses.calls) == 6 + + assert hass.states.get("climate.Sala_room_temperature").state == HVACMode.DRY + assert hass.states.get("climate.Sala_room_temperature").attributes["fan_mode"] == "auto" + + async def test_dry2( hass: HomeAssistant, config_entry: MockConfigEntry, From 1511f53628667b895be1a794789c91713191545c Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 21 Oct 2024 12:47:41 +0200 Subject: [PATCH 2/4] Improve logging * custom_components/daikin_onecta/climate.py: --- custom_components/daikin_onecta/climate.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/custom_components/daikin_onecta/climate.py b/custom_components/daikin_onecta/climate.py index 7db958c..53a155c 100644 --- a/custom_components/daikin_onecta/climate.py +++ b/custom_components/daikin_onecta/climate.py @@ -445,12 +445,17 @@ def get_fan_mode(self): if mode == FANMODE_FIXED: fsm = fan_speed.get("modes") if fsm is not None: - _LOGGER.info("FSM %s", fsm) fixedModes = fsm[mode] fan_mode = str(fixedModes["value"]) else: fan_mode = mode + _LOGGER.info( + "Device '%s' has fan mode '%s'", + self._device.name, + fan_mode, + ) + return fan_mode def get_fan_modes(self): @@ -466,11 +471,9 @@ def get_fan_modes(self): if fan_speed is not None: _LOGGER.info("Found fanspeed %s", fan_speed) for c in fan_speed["currentMode"]["values"]: - _LOGGER.info("Device '%s' found fan mode %s", self._device.name, c) if c == FANMODE_FIXED: fsm = fan_speed.get("modes") if fsm is not None: - _LOGGER.info("Device '%s' found fixed %s", self._device.name, fsm) fixedModes = fsm[c] min_val = int(fixedModes["minValue"]) max_val = int(fixedModes["maxValue"]) @@ -480,6 +483,12 @@ def get_fan_modes(self): else: fan_modes.append(c) + _LOGGER.info( + "Device '%s' has fan modes '%s'", + self._device.name, + fan_modes, + ) + return fan_modes async def async_set_fan_mode(self, fan_mode): From 63296c396c389a7b0e45ef21f62a0a5f8669ce7f Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 21 Oct 2024 12:48:35 +0200 Subject: [PATCH 3/4] Add quotes * custom_components/daikin_onecta/climate.py: --- custom_components/daikin_onecta/climate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/daikin_onecta/climate.py b/custom_components/daikin_onecta/climate.py index 53a155c..6508e1b 100644 --- a/custom_components/daikin_onecta/climate.py +++ b/custom_components/daikin_onecta/climate.py @@ -494,7 +494,7 @@ def get_fan_modes(self): async def async_set_fan_mode(self, fan_mode): """Set the fan mode""" _LOGGER.debug( - "Device '%s' request to set fan_mode to %s", + "Device '%s' request to set fan_mode to '%s'", self._device.name, fan_mode, ) From a2e0fb247ca92ddcdad51e97b7607b87bdb32196 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 21 Oct 2024 12:49:51 +0200 Subject: [PATCH 4/4] Added test json --- tests/fixtures/fanmode.json | 795 ++++++++++++++++++++++++++++++++++++ 1 file changed, 795 insertions(+) create mode 100644 tests/fixtures/fanmode.json diff --git a/tests/fixtures/fanmode.json b/tests/fixtures/fanmode.json new file mode 100644 index 0000000..c788782 --- /dev/null +++ b/tests/fixtures/fanmode.json @@ -0,0 +1,795 @@ +[ +{ + "_id": "13995b32-fc6e-43ed-918e-5d2b01095ccb", + "id": "13995b32-fc6e-43ed-918e-5d2b01095ccb", + "type": "dx23", + "deviceModel": "dx23", + "isCloudConnectionUp": { + "settable": false, + "value": true + }, + "managementPoints": [ + { + "embeddedId": "gateway", + "managementPointType": "gateway", + "managementPointCategory": "secondary", + "name": { + "settable": false, + "maxLength": 32, + "value": "Gateway" + }, + "modelInfo": { + "settable": false, + "value": "BRP069A4x" + }, + "ipAddress": { + "settable": false, + "value": "192.168.1.2" + }, + "macAddress": { + "settable": false, + "value": "MANUALLY_REMOVED" + }, + "firmwareVersion": { + "settable": false, + "value": "4_0_3" + }, + "isFirmwareUpdateSupported": { + "settable": false, + "value": true + } + }, + { + "embeddedId": "climateControl", + "managementPointType": "climateControl", + "managementPointSubType": "mainZone", + "managementPointCategory": "primary", + "onOffMode": { + "settable": true, + "values": [ + "on", + "off" + ], + "value": "off" + }, + "name": { + "settable": false, + "maxLength": 32, + "value": "Sala" + }, + "isHolidayModeActive": { + "settable": false, + "value": false + }, + "isInErrorState": { + "settable": false, + "value": false + }, + "errorCode": { + "settable": false, + "value": "00" + }, + "operationMode": { + "settable": true, + "values": [ + "auto", + "dry", + "cooling", + "heating", + "fanOnly" + ], + "value": "heating" + }, + "temperatureControl": { + "ref": "#temperatureControl", + "settable": true, + "value": { + "operationModes": { + "auto": { + "setpoints": { + "roomTemperature": { + "settable": true, + "value": 25, + "minValue": 18, + "maxValue": 30, + "stepValue": 0.5 + } + } + }, + "cooling": { + "setpoints": { + "roomTemperature": { + "settable": true, + "value": 25, + "minValue": 18, + "maxValue": 32, + "stepValue": 0.5 + } + } + }, + "heating": { + "setpoints": { + "roomTemperature": { + "settable": true, + "value": 25, + "minValue": 10, + "maxValue": 30, + "stepValue": 0.5 + } + } + } + } + } + }, + "sensoryData": { + "ref": "#sensoryData", + "settable": false, + "value": { + "roomTemperature": { + "settable": false, + "value": 21 + }, + "outdoorTemperature": { + "settable": false, + "value": 18 + } + } + }, + "fanControl": { + "ref": "#fanControl", + "settable": true, + "value": { + "operationModes": { + "auto": { + "fanDirection": { + "horizontal": { + "currentMode": { + "settable": true, + "value": "stop", + "values": [ + "stop", + "swing" + ] + } + }, + "vertical": { + "currentMode": { + "settable": true, + "value": "stop", + "values": [ + "stop", + "swing" + ] + } + } + }, + "fanSpeed": { + "currentMode": { + "settable": true, + "value": "fixed", + "values": [ + "quiet", + "auto", + "fixed" + ] + }, + "modes": { + "fixed": { + "value": 3, + "settable": true, + "maxValue": 5, + "minValue": 1, + "stepValue": 1 + } + } + } + }, + "dry": { + "fanDirection": { + "horizontal": { + "currentMode": { + "settable": true, + "value": "stop", + "values": [ + "stop", + "swing" + ] + } + }, + "vertical": { + "currentMode": { + "settable": true, + "value": "stop", + "values": [ + "stop", + "swing" + ] + } + } + }, + "fanSpeed": { + "currentMode": { + "settable": true, + "value": "auto", + "values": [ + "auto" + ] + } + } + }, + "cooling": { + "fanDirection": { + "horizontal": { + "currentMode": { + "settable": true, + "value": "stop", + "values": [ + "stop", + "swing" + ] + } + }, + "vertical": { + "currentMode": { + "settable": true, + "value": "stop", + "values": [ + "stop", + "swing" + ] + } + } + }, + "fanSpeed": { + "currentMode": { + "settable": true, + "value": "fixed", + "values": [ + "quiet", + "auto", + "fixed" + ] + }, + "modes": { + "fixed": { + "value": 3, + "settable": true, + "maxValue": 5, + "minValue": 1, + "stepValue": 1 + } + } + } + }, + "heating": { + "fanDirection": { + "horizontal": { + "currentMode": { + "settable": true, + "value": "stop", + "values": [ + "stop", + "swing" + ] + } + }, + "vertical": { + "currentMode": { + "settable": true, + "value": "stop", + "values": [ + "stop", + "swing" + ] + } + } + }, + "fanSpeed": { + "currentMode": { + "settable": true, + "value": "auto", + "values": [ + "quiet", + "auto", + "fixed" + ] + }, + "modes": { + "fixed": { + "value": 1, + "settable": true, + "maxValue": 5, + "minValue": 1, + "stepValue": 1 + } + } + } + }, + "fanOnly": { + "fanDirection": { + "horizontal": { + "currentMode": { + "settable": true, + "value": "stop", + "values": [ + "stop", + "swing" + ] + } + }, + "vertical": { + "currentMode": { + "settable": true, + "value": "stop", + "values": [ + "stop", + "swing" + ] + } + } + }, + "fanSpeed": { + "currentMode": { + "settable": true, + "value": "fixed", + "values": [ + "quiet", + "auto", + "fixed" + ] + }, + "modes": { + "fixed": { + "value": 3, + "settable": true, + "maxValue": 5, + "minValue": 1, + "stepValue": 1 + } + } + } + } + } + } + }, + "schedule": { + "ref": "#schedule", + "settable": true, + "value": { + "currentMode": { + "value": "any", + "settable": true, + "values": [ + "any" + ] + }, + "nextAction": {}, + "modes": { + "any": { + "currentSchedule": { + "value": "0", + "settable": true, + "values": [ + "0", + "1", + "2" + ] + }, + "enabled": { + "value": false, + "settable": true + }, + "meta": { + "minIntervalBetweenActions": "00:01:00", + "maxSchedules": 1, + "maxActionsPerActionPeriod": 6, + "consecutiveActionsAllowed": true, + "actionTypes": { + "operationMode": { + "settable": false, + "values": [ + "auto", + "dry", + "cooling", + "heating", + "fanOnly", + "off" + ] + }, + "roomTemperature": { + "auto": { + "settable": false, + "stepValue": 0.5, + "minValue": 18, + "maxValue": 30 + }, + "cooling": { + "settable": false, + "stepValue": 0.5, + "minValue": 18, + "maxValue": 32 + }, + "heating": { + "settable": false, + "stepValue": 0.5, + "minValue": 10, + "maxValue": 30 + } + }, + "fanSpeed": { + "auto": { + "currentMode": { + "values": [ + "quiet", + "auto", + "fixed" + ], + "settable": false + }, + "modes": { + "fixed": { + "settable": false, + "maxValue": 5, + "minValue": 1, + "stepValue": 1 + } + } + }, + "dry": { + "currentMode": { + "values": [ + "auto" + ], + "settable": false + } + }, + "cooling": { + "currentMode": { + "values": [ + "quiet", + "auto", + "fixed" + ], + "settable": false + }, + "modes": { + "fixed": { + "settable": false, + "maxValue": 5, + "minValue": 1, + "stepValue": 1 + } + } + }, + "heating": { + "currentMode": { + "values": [ + "quiet", + "auto", + "fixed" + ], + "settable": false + }, + "modes": { + "fixed": { + "settable": false, + "maxValue": 5, + "minValue": 1, + "stepValue": 1 + } + } + }, + "fanOnly": { + "currentMode": { + "values": [ + "quiet", + "auto", + "fixed" + ], + "settable": false + }, + "modes": { + "fixed": { + "settable": false, + "maxValue": 5, + "minValue": 1, + "stepValue": 1 + } + } + } + } + } + }, + "schedules": { + "0": { + "name": { + "settable": false, + "value": "", + "maxLength": 32 + }, + "meta": { + "isReadOnly": false, + "actionPeriods": [ + "monday", + "tuesday", + "wednesday", + "thursday", + "friday", + "saturday", + "sunday" + ] + }, + "actions": { + "monday": { + "00:00:00": { + "operationMode": "off" + } + }, + "tuesday": { + "00:00:00": { + "operationMode": "off" + } + }, + "wednesday": { + "00:00:00": { + "operationMode": "off" + } + }, + "thursday": { + "00:00:00": { + "operationMode": "off" + } + }, + "friday": { + "00:00:00": { + "operationMode": "off" + } + }, + "saturday": { + "00:00:00": { + "operationMode": "off" + } + }, + "sunday": { + "00:00:00": { + "operationMode": "off" + } + } + }, + "settable": false + }, + "1": { + "name": { + "settable": false, + "value": "", + "maxLength": 32 + }, + "meta": { + "isReadOnly": false, + "actionPeriods": [ + "monday", + "tuesday", + "wednesday", + "thursday", + "friday", + "saturday", + "sunday" + ] + }, + "actions": {}, + "settable": false + }, + "2": { + "name": { + "settable": false, + "value": "", + "maxLength": 32 + }, + "meta": { + "isReadOnly": false, + "actionPeriods": [ + "monday", + "tuesday", + "wednesday", + "thursday", + "friday", + "saturday", + "sunday" + ] + }, + "actions": {}, + "settable": false + } + } + } + } + } + }, + "isPowerfulModeActive": { + "settable": false, + "value": false + }, + "powerfulMode": { + "settable": true, + "values": [ + "on", + "off" + ], + "value": "off" + }, + "consumptionData": { + "ref": "#consumptionData", + "settable": false, + "value": { + "electrical": { + "unit": "kWh", + "heating": { + "d": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "w": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + null, + null, + null, + null, + null, + null + ], + "m": [ + 2.2, + 0.8, + 0.4, + 0.5, + 0.5, + 0, + 0, + 0, + 0, + 0, + 0, + 1.2, + 0.9, + 0, + 0.6, + 0.3, + 0, + 0, + 0, + 0, + 0.1, + 0, + 0, + 0 + ] + }, + "cooling": { + "d": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0.1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "w": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0.1, + 0, + null, + null, + null, + null, + null, + null + ], + "m": [ + 0, + 0, + 0, + 0.2, + 0.5, + 1.7, + 6.6, + 5.7, + 1, + 0.4, + 0.8, + 0.1, + 0, + 0, + 0, + 0, + 0, + 2.4, + 14.3, + 9.4, + 0.7, + 0.1, + 0, + 0 + ] + } + } + } + }, + "holidayMode": { + "ref": "#holidayMode", + "settable": true, + "value": { + "enabled": false + } + } + }, + { + "embeddedId": "indoorUnit", + "managementPointType": "indoorUnit", + "managementPointCategory": "secondary", + "name": { + "settable": false, + "maxLength": 32, + "value": "Indoor Unit" + }, + "softwareVersion": { + "settable": false, + "value": "3.20" + } + } + ], + "embeddedId": "53588aa5-df40-42f7-83c2-730952dfd262", + "timestamp": "2024-10-21T09:33:53.683Z" + } +]