From a36733c4dc146e28b8e82ef28b2c64e2156e636b Mon Sep 17 00:00:00 2001 From: Panda-NZ <32557789+pandanz@users.noreply.github.com> Date: Tue, 10 Mar 2026 11:40:30 +1300 Subject: [PATCH] Add ambient temperature range controls to ToGrill integration (#165235) --- .../components/togrill/coordinator.py | 4 +- homeassistant/components/togrill/number.py | 54 +- homeassistant/components/togrill/strings.json | 6 + .../togrill/snapshots/test_number.ambr | 1644 +++++++++++++++++ tests/components/togrill/test_number.py | 144 ++ 5 files changed, 1850 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/togrill/coordinator.py b/homeassistant/components/togrill/coordinator.py index 6d01e279b05..6f2419ef821 100644 --- a/homeassistant/components/togrill/coordinator.py +++ b/homeassistant/components/togrill/coordinator.py @@ -32,7 +32,7 @@ from homeassistant.helpers import device_registry as dr from homeassistant.helpers.device_registry import CONNECTION_BLUETOOTH, DeviceInfo from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed -from .const import CONF_PROBE_COUNT, DOMAIN +from .const import CONF_HAS_AMBIENT, CONF_PROBE_COUNT, DOMAIN type ToGrillConfigEntry = ConfigEntry[ToGrillCoordinator] @@ -213,6 +213,8 @@ class ToGrillCoordinator(DataUpdateCoordinator[dict[tuple[int, int | None], Pack await client.request(PacketA1Notify) for probe in range(1, self.config_entry.data[CONF_PROBE_COUNT] + 1): await client.write(PacketA8Write(probe=probe)) + if self.config_entry.data.get(CONF_HAS_AMBIENT): + await client.write(PacketA8Write(probe=0)) except BleakError as exc: raise DeviceFailed(f"Device failed {exc}") from exc return self.data diff --git a/homeassistant/components/togrill/number.py b/homeassistant/components/togrill/number.py index 9499bb49e01..fa6f0b69ae8 100644 --- a/homeassistant/components/togrill/number.py +++ b/homeassistant/components/togrill/number.py @@ -27,7 +27,7 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from . import ToGrillConfigEntry -from .const import CONF_PROBE_COUNT, MAX_PROBE_COUNT +from .const import CONF_HAS_AMBIENT, CONF_PROBE_COUNT, MAX_PROBE_COUNT from .coordinator import ToGrillCoordinator from .entity import ToGrillEntity @@ -123,12 +123,64 @@ def _get_temperature_descriptions( ) +def _get_ambient_temperatures( + coordinator: ToGrillCoordinator, alarm_type: AlarmType +) -> tuple[float | None, float | None]: + if not (packet := coordinator.get_packet(PacketA8Notify, 0)): + return None, None + if packet.alarm_type != alarm_type: + return None, None + return packet.temperature_1, packet.temperature_2 + + ENTITY_DESCRIPTIONS = ( *[ description for probe_number in range(1, MAX_PROBE_COUNT + 1) for description in _get_temperature_descriptions(probe_number) ], + ToGrillNumberEntityDescription( + key="ambient_temperature_minimum", + translation_key="ambient_temperature_minimum", + device_class=NumberDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + native_min_value=0, + native_max_value=400, + mode=NumberMode.BOX, + icon="mdi:thermometer-chevron-down", + set_packet=lambda coordinator, value: PacketA300Write( + probe=0, + minimum=None if value == 0.0 else value, + maximum=_get_ambient_temperatures(coordinator, AlarmType.TEMPERATURE_RANGE)[ + 1 + ], + ), + get_value=lambda x: _get_ambient_temperatures(x, AlarmType.TEMPERATURE_RANGE)[ + 0 + ], + entity_supported=lambda x: x.get(CONF_HAS_AMBIENT, False), + ), + ToGrillNumberEntityDescription( + key="ambient_temperature_maximum", + translation_key="ambient_temperature_maximum", + device_class=NumberDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + native_min_value=0, + native_max_value=400, + mode=NumberMode.BOX, + icon="mdi:thermometer-chevron-up", + set_packet=lambda coordinator, value: PacketA300Write( + probe=0, + minimum=_get_ambient_temperatures(coordinator, AlarmType.TEMPERATURE_RANGE)[ + 0 + ], + maximum=None if value == 0.0 else value, + ), + get_value=lambda x: _get_ambient_temperatures(x, AlarmType.TEMPERATURE_RANGE)[ + 1 + ], + entity_supported=lambda x: x.get(CONF_HAS_AMBIENT, False), + ), ToGrillNumberEntityDescription( key="alarm_interval", translation_key="alarm_interval", diff --git a/homeassistant/components/togrill/strings.json b/homeassistant/components/togrill/strings.json index 2db82fe6f46..41b5c036b0e 100644 --- a/homeassistant/components/togrill/strings.json +++ b/homeassistant/components/togrill/strings.json @@ -55,6 +55,12 @@ "alarm_interval": { "name": "Alarm interval" }, + "ambient_temperature_maximum": { + "name": "Ambient maximum temperature" + }, + "ambient_temperature_minimum": { + "name": "Ambient minimum temperature" + }, "temperature_maximum": { "name": "Maximum temperature" }, diff --git a/tests/components/togrill/snapshots/test_number.ambr b/tests/components/togrill/snapshots/test_number.ambr index 972158ef629..869431e51fc 100644 --- a/tests/components/togrill/snapshots/test_number.ambr +++ b/tests/components/togrill/snapshots/test_number.ambr @@ -851,3 +851,1647 @@ 'state': 'unknown', }) # --- +# name: test_setup_with_ambient[ambient_with_range][number.pro_05_alarm_interval-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 15, + 'min': 0, + 'mode': , + 'step': 5, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.pro_05_alarm_interval', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Alarm interval', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Alarm interval', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'alarm_interval', + 'unique_id': '00000000-0000-0000-0000-000000000001_alarm_interval', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[ambient_with_range][number.pro_05_alarm_interval-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'duration', + 'friendly_name': 'Pro-05 Alarm interval', + 'max': 15, + 'min': 0, + 'mode': , + 'step': 5, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.pro_05_alarm_interval', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '0', + }) +# --- +# name: test_setup_with_ambient[ambient_with_range][number.pro_05_ambient_maximum_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 400, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.pro_05_ambient_maximum_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Ambient maximum temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-chevron-up', + 'original_name': 'Ambient maximum temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'ambient_temperature_maximum', + 'unique_id': '00000000-0000-0000-0000-000000000001_ambient_temperature_maximum', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[ambient_with_range][number.pro_05_ambient_maximum_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Pro-05 Ambient maximum temperature', + 'icon': 'mdi:thermometer-chevron-up', + 'max': 400, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.pro_05_ambient_maximum_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '300.0', + }) +# --- +# name: test_setup_with_ambient[ambient_with_range][number.pro_05_ambient_minimum_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 400, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.pro_05_ambient_minimum_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Ambient minimum temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-chevron-down', + 'original_name': 'Ambient minimum temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'ambient_temperature_minimum', + 'unique_id': '00000000-0000-0000-0000-000000000001_ambient_temperature_minimum', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[ambient_with_range][number.pro_05_ambient_minimum_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Pro-05 Ambient minimum temperature', + 'icon': 'mdi:thermometer-chevron-down', + 'max': 400, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.pro_05_ambient_minimum_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '5.0', + }) +# --- +# name: test_setup_with_ambient[ambient_with_range][number.probe_1_maximum_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.probe_1_maximum_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Maximum temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-chevron-up', + 'original_name': 'Maximum temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'temperature_maximum', + 'unique_id': '00000000-0000-0000-0000-000000000001_temperature_maximum_1', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[ambient_with_range][number.probe_1_maximum_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Probe 1 Maximum temperature', + 'icon': 'mdi:thermometer-chevron-up', + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.probe_1_maximum_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[ambient_with_range][number.probe_1_minimum_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.probe_1_minimum_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Minimum temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-chevron-down', + 'original_name': 'Minimum temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'temperature_minimum', + 'unique_id': '00000000-0000-0000-0000-000000000001_temperature_minimum_1', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[ambient_with_range][number.probe_1_minimum_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Probe 1 Minimum temperature', + 'icon': 'mdi:thermometer-chevron-down', + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.probe_1_minimum_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[ambient_with_range][number.probe_1_target_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.probe_1_target_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Target temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-check', + 'original_name': 'Target temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'temperature_target', + 'unique_id': '00000000-0000-0000-0000-000000000001_temperature_target_1', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[ambient_with_range][number.probe_1_target_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Probe 1 Target temperature', + 'icon': 'mdi:thermometer-check', + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.probe_1_target_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[ambient_with_range][number.probe_2_maximum_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.probe_2_maximum_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Maximum temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-chevron-up', + 'original_name': 'Maximum temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'temperature_maximum', + 'unique_id': '00000000-0000-0000-0000-000000000001_temperature_maximum_2', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[ambient_with_range][number.probe_2_maximum_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Probe 2 Maximum temperature', + 'icon': 'mdi:thermometer-chevron-up', + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.probe_2_maximum_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[ambient_with_range][number.probe_2_minimum_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.probe_2_minimum_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Minimum temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-chevron-down', + 'original_name': 'Minimum temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'temperature_minimum', + 'unique_id': '00000000-0000-0000-0000-000000000001_temperature_minimum_2', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[ambient_with_range][number.probe_2_minimum_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Probe 2 Minimum temperature', + 'icon': 'mdi:thermometer-chevron-down', + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.probe_2_minimum_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[ambient_with_range][number.probe_2_target_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.probe_2_target_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Target temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-check', + 'original_name': 'Target temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'temperature_target', + 'unique_id': '00000000-0000-0000-0000-000000000001_temperature_target_2', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[ambient_with_range][number.probe_2_target_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Probe 2 Target temperature', + 'icon': 'mdi:thermometer-check', + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.probe_2_target_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[ambient_wrong_alarm_type][number.pro_05_alarm_interval-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 15, + 'min': 0, + 'mode': , + 'step': 5, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.pro_05_alarm_interval', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Alarm interval', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Alarm interval', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'alarm_interval', + 'unique_id': '00000000-0000-0000-0000-000000000001_alarm_interval', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[ambient_wrong_alarm_type][number.pro_05_alarm_interval-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'duration', + 'friendly_name': 'Pro-05 Alarm interval', + 'max': 15, + 'min': 0, + 'mode': , + 'step': 5, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.pro_05_alarm_interval', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '0', + }) +# --- +# name: test_setup_with_ambient[ambient_wrong_alarm_type][number.pro_05_ambient_maximum_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 400, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.pro_05_ambient_maximum_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Ambient maximum temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-chevron-up', + 'original_name': 'Ambient maximum temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'ambient_temperature_maximum', + 'unique_id': '00000000-0000-0000-0000-000000000001_ambient_temperature_maximum', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[ambient_wrong_alarm_type][number.pro_05_ambient_maximum_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Pro-05 Ambient maximum temperature', + 'icon': 'mdi:thermometer-chevron-up', + 'max': 400, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.pro_05_ambient_maximum_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[ambient_wrong_alarm_type][number.pro_05_ambient_minimum_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 400, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.pro_05_ambient_minimum_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Ambient minimum temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-chevron-down', + 'original_name': 'Ambient minimum temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'ambient_temperature_minimum', + 'unique_id': '00000000-0000-0000-0000-000000000001_ambient_temperature_minimum', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[ambient_wrong_alarm_type][number.pro_05_ambient_minimum_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Pro-05 Ambient minimum temperature', + 'icon': 'mdi:thermometer-chevron-down', + 'max': 400, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.pro_05_ambient_minimum_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[ambient_wrong_alarm_type][number.probe_1_maximum_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.probe_1_maximum_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Maximum temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-chevron-up', + 'original_name': 'Maximum temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'temperature_maximum', + 'unique_id': '00000000-0000-0000-0000-000000000001_temperature_maximum_1', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[ambient_wrong_alarm_type][number.probe_1_maximum_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Probe 1 Maximum temperature', + 'icon': 'mdi:thermometer-chevron-up', + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.probe_1_maximum_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[ambient_wrong_alarm_type][number.probe_1_minimum_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.probe_1_minimum_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Minimum temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-chevron-down', + 'original_name': 'Minimum temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'temperature_minimum', + 'unique_id': '00000000-0000-0000-0000-000000000001_temperature_minimum_1', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[ambient_wrong_alarm_type][number.probe_1_minimum_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Probe 1 Minimum temperature', + 'icon': 'mdi:thermometer-chevron-down', + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.probe_1_minimum_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[ambient_wrong_alarm_type][number.probe_1_target_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.probe_1_target_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Target temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-check', + 'original_name': 'Target temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'temperature_target', + 'unique_id': '00000000-0000-0000-0000-000000000001_temperature_target_1', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[ambient_wrong_alarm_type][number.probe_1_target_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Probe 1 Target temperature', + 'icon': 'mdi:thermometer-check', + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.probe_1_target_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[ambient_wrong_alarm_type][number.probe_2_maximum_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.probe_2_maximum_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Maximum temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-chevron-up', + 'original_name': 'Maximum temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'temperature_maximum', + 'unique_id': '00000000-0000-0000-0000-000000000001_temperature_maximum_2', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[ambient_wrong_alarm_type][number.probe_2_maximum_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Probe 2 Maximum temperature', + 'icon': 'mdi:thermometer-chevron-up', + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.probe_2_maximum_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[ambient_wrong_alarm_type][number.probe_2_minimum_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.probe_2_minimum_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Minimum temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-chevron-down', + 'original_name': 'Minimum temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'temperature_minimum', + 'unique_id': '00000000-0000-0000-0000-000000000001_temperature_minimum_2', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[ambient_wrong_alarm_type][number.probe_2_minimum_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Probe 2 Minimum temperature', + 'icon': 'mdi:thermometer-chevron-down', + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.probe_2_minimum_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[ambient_wrong_alarm_type][number.probe_2_target_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.probe_2_target_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Target temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-check', + 'original_name': 'Target temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'temperature_target', + 'unique_id': '00000000-0000-0000-0000-000000000001_temperature_target_2', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[ambient_wrong_alarm_type][number.probe_2_target_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Probe 2 Target temperature', + 'icon': 'mdi:thermometer-check', + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.probe_2_target_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[no_data][number.pro_05_alarm_interval-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 15, + 'min': 0, + 'mode': , + 'step': 5, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.pro_05_alarm_interval', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Alarm interval', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Alarm interval', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'alarm_interval', + 'unique_id': '00000000-0000-0000-0000-000000000001_alarm_interval', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[no_data][number.pro_05_alarm_interval-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'duration', + 'friendly_name': 'Pro-05 Alarm interval', + 'max': 15, + 'min': 0, + 'mode': , + 'step': 5, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.pro_05_alarm_interval', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '0', + }) +# --- +# name: test_setup_with_ambient[no_data][number.pro_05_ambient_maximum_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 400, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.pro_05_ambient_maximum_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Ambient maximum temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-chevron-up', + 'original_name': 'Ambient maximum temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'ambient_temperature_maximum', + 'unique_id': '00000000-0000-0000-0000-000000000001_ambient_temperature_maximum', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[no_data][number.pro_05_ambient_maximum_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Pro-05 Ambient maximum temperature', + 'icon': 'mdi:thermometer-chevron-up', + 'max': 400, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.pro_05_ambient_maximum_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[no_data][number.pro_05_ambient_minimum_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 400, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.pro_05_ambient_minimum_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Ambient minimum temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-chevron-down', + 'original_name': 'Ambient minimum temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'ambient_temperature_minimum', + 'unique_id': '00000000-0000-0000-0000-000000000001_ambient_temperature_minimum', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[no_data][number.pro_05_ambient_minimum_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Pro-05 Ambient minimum temperature', + 'icon': 'mdi:thermometer-chevron-down', + 'max': 400, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.pro_05_ambient_minimum_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[no_data][number.probe_1_maximum_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.probe_1_maximum_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Maximum temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-chevron-up', + 'original_name': 'Maximum temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'temperature_maximum', + 'unique_id': '00000000-0000-0000-0000-000000000001_temperature_maximum_1', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[no_data][number.probe_1_maximum_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Probe 1 Maximum temperature', + 'icon': 'mdi:thermometer-chevron-up', + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.probe_1_maximum_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[no_data][number.probe_1_minimum_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.probe_1_minimum_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Minimum temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-chevron-down', + 'original_name': 'Minimum temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'temperature_minimum', + 'unique_id': '00000000-0000-0000-0000-000000000001_temperature_minimum_1', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[no_data][number.probe_1_minimum_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Probe 1 Minimum temperature', + 'icon': 'mdi:thermometer-chevron-down', + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.probe_1_minimum_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[no_data][number.probe_1_target_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.probe_1_target_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Target temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-check', + 'original_name': 'Target temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'temperature_target', + 'unique_id': '00000000-0000-0000-0000-000000000001_temperature_target_1', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[no_data][number.probe_1_target_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Probe 1 Target temperature', + 'icon': 'mdi:thermometer-check', + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.probe_1_target_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[no_data][number.probe_2_maximum_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.probe_2_maximum_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Maximum temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-chevron-up', + 'original_name': 'Maximum temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'temperature_maximum', + 'unique_id': '00000000-0000-0000-0000-000000000001_temperature_maximum_2', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[no_data][number.probe_2_maximum_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Probe 2 Maximum temperature', + 'icon': 'mdi:thermometer-chevron-up', + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.probe_2_maximum_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[no_data][number.probe_2_minimum_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.probe_2_minimum_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Minimum temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-chevron-down', + 'original_name': 'Minimum temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'temperature_minimum', + 'unique_id': '00000000-0000-0000-0000-000000000001_temperature_minimum_2', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[no_data][number.probe_2_minimum_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Probe 2 Minimum temperature', + 'icon': 'mdi:thermometer-chevron-down', + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.probe_2_minimum_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_setup_with_ambient[no_data][number.probe_2_target_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'number', + 'entity_category': None, + 'entity_id': 'number.probe_2_target_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Target temperature', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': 'mdi:thermometer-check', + 'original_name': 'Target temperature', + 'platform': 'togrill', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'temperature_target', + 'unique_id': '00000000-0000-0000-0000-000000000001_temperature_target_2', + 'unit_of_measurement': , + }) +# --- +# name: test_setup_with_ambient[no_data][number.probe_2_target_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'temperature', + 'friendly_name': 'Probe 2 Target temperature', + 'icon': 'mdi:thermometer-check', + 'max': 250, + 'min': 0, + 'mode': , + 'step': 1.0, + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'number.probe_2_target_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- diff --git a/tests/components/togrill/test_number.py b/tests/components/togrill/test_number.py index fb88a0d466a..f32720219bc 100644 --- a/tests/components/togrill/test_number.py +++ b/tests/components/togrill/test_number.py @@ -77,6 +77,150 @@ async def test_setup( await snapshot_platform(hass, entity_registry, snapshot, mock_entry.entry_id) +@pytest.mark.parametrize( + "packets", + [ + pytest.param([], id="no_data"), + pytest.param( + [ + PacketA8Notify( + probe=0, + alarm_type=PacketA8Notify.AlarmType.TEMPERATURE_RANGE, + temperature_1=5.0, + temperature_2=300.0, + ), + ], + id="ambient_with_range", + ), + pytest.param( + [ + PacketA8Notify( + probe=0, + alarm_type=None, + temperature_1=5.0, + temperature_2=300.0, + ), + ], + id="ambient_wrong_alarm_type", + ), + ], +) +async def test_setup_with_ambient( + hass: HomeAssistant, + entity_registry: er.EntityRegistry, + snapshot: SnapshotAssertion, + mock_entry_with_ambient: MockConfigEntry, + mock_client: Mock, + packets, +) -> None: + """Test the numbers with ambient sensor enabled.""" + + inject_bluetooth_service_info(hass, TOGRILL_SERVICE_INFO) + + await setup_entry(hass, mock_entry_with_ambient, [Platform.NUMBER]) + + for packet in packets: + mock_client.mocked_notify(packet) + + await snapshot_platform( + hass, entity_registry, snapshot, mock_entry_with_ambient.entry_id + ) + + +@pytest.mark.parametrize( + ("packets", "entity_id", "value", "write_packet"), + [ + pytest.param( + [ + PacketA8Notify( + probe=0, + alarm_type=PacketA8Notify.AlarmType.TEMPERATURE_RANGE, + temperature_1=5.0, + temperature_2=300.0, + ), + ], + "number.pro_05_ambient_minimum_temperature", + 10.0, + PacketA300Write(probe=0, minimum=10.0, maximum=300.0), + id="ambient_minimum", + ), + pytest.param( + [ + PacketA8Notify( + probe=0, + alarm_type=PacketA8Notify.AlarmType.TEMPERATURE_RANGE, + temperature_1=5.0, + temperature_2=300.0, + ), + ], + "number.pro_05_ambient_minimum_temperature", + 0.0, + PacketA300Write(probe=0, minimum=None, maximum=300.0), + id="ambient_minimum_clear", + ), + pytest.param( + [ + PacketA8Notify( + probe=0, + alarm_type=PacketA8Notify.AlarmType.TEMPERATURE_RANGE, + temperature_1=5.0, + temperature_2=300.0, + ), + ], + "number.pro_05_ambient_maximum_temperature", + 350.0, + PacketA300Write(probe=0, minimum=5.0, maximum=350.0), + id="ambient_maximum", + ), + pytest.param( + [ + PacketA8Notify( + probe=0, + alarm_type=PacketA8Notify.AlarmType.TEMPERATURE_RANGE, + temperature_1=5.0, + temperature_2=300.0, + ), + ], + "number.pro_05_ambient_maximum_temperature", + 0.0, + PacketA300Write(probe=0, minimum=5.0, maximum=None), + id="ambient_maximum_clear", + ), + ], +) +async def test_set_ambient_number( + hass: HomeAssistant, + mock_entry_with_ambient: MockConfigEntry, + mock_client: Mock, + packets, + entity_id, + value, + write_packet, +) -> None: + """Test setting ambient temperature numbers.""" + + inject_bluetooth_service_info(hass, TOGRILL_SERVICE_INFO) + + await setup_entry(hass, mock_entry_with_ambient, [Platform.NUMBER]) + + for packet in packets: + mock_client.mocked_notify(packet) + + await hass.services.async_call( + NUMBER_DOMAIN, + SERVICE_SET_VALUE, + service_data={ + ATTR_VALUE: value, + }, + target={ + ATTR_ENTITY_ID: entity_id, + }, + blocking=True, + ) + + mock_client.write.assert_any_call(write_packet) + + @pytest.mark.parametrize( ("packets", "entity_id", "value", "write_packet"), [