diff --git a/tests/components/tuya/__init__.py b/tests/components/tuya/__init__.py index 61c559ecffe..1dacd799744 100644 --- a/tests/components/tuya/__init__.py +++ b/tests/components/tuya/__init__.py @@ -40,6 +40,11 @@ DEVICE_MOCKS = { Platform.BINARY_SENSOR, Platform.SENSOR, ], + "rqbj_gas_sensor": [ + # https://github.com/orgs/home-assistant/discussions/100 + Platform.BINARY_SENSOR, + Platform.SENSOR, + ], "sfkzq_valve_controller": [ # https://github.com/home-assistant/core/issues/148116 Platform.SWITCH, diff --git a/tests/components/tuya/fixtures/rqbj_gas_sensor.json b/tests/components/tuya/fixtures/rqbj_gas_sensor.json new file mode 100644 index 00000000000..58cbaedb0f1 --- /dev/null +++ b/tests/components/tuya/fixtures/rqbj_gas_sensor.json @@ -0,0 +1,90 @@ +{ + "endpoint": "https://apigw.tuyaus.com", + "terminal_id": "17421891051898r7yM6", + "mqtt_connected": true, + "disabled_by": null, + "disabled_polling": false, + "id": "ebb9d0eb5014f98cfboxbz", + "name": "Gas sensor", + "category": "rqbj", + "product_id": "4iqe2hsfyd86kwwc", + "product_name": "Gas sensor", + "online": true, + "sub": false, + "time_zone": "-04:00", + "active_time": "2025-06-24T20:33:10+00:00", + "create_time": "2025-06-24T20:33:10+00:00", + "update_time": "2025-06-24T20:33:10+00:00", + "function": { + "alarm_time": { + "type": "Integer", + "value": { + "unit": "s", + "min": 0, + "max": 3600, + "scale": 0, + "step": 1 + } + }, + "self_checking": { + "type": "Boolean", + "value": {} + }, + "muffling": { + "type": "Boolean", + "value": {} + } + }, + "status_range": { + "checking_result": { + "type": "Enum", + "value": { + "range": ["checking", "check_success", "check_failure", "others"] + } + }, + "gas_sensor_status": { + "type": "Enum", + "value": { + "range": ["alarm", "normal"] + } + }, + "alarm_time": { + "type": "Integer", + "value": { + "unit": "s", + "min": 0, + "max": 3600, + "scale": 0, + "step": 1 + } + }, + "gas_sensor_value": { + "type": "Integer", + "value": { + "unit": "ppm", + "min": 0, + "max": 999, + "scale": 0, + "step": 1 + } + }, + "self_checking": { + "type": "Boolean", + "value": {} + }, + "muffling": { + "type": "Boolean", + "value": {} + } + }, + "status": { + "checking_result": "check_success", + "gas_sensor_status": "normal", + "alarm_time": 300, + "gas_sensor_value": 0, + "self_checking": false, + "muffling": true + }, + "set_up": true, + "support_local": true +} diff --git a/tests/components/tuya/snapshots/test_binary_sensor.ambr b/tests/components/tuya/snapshots/test_binary_sensor.ambr index aacda463769..b269664a2d4 100644 --- a/tests/components/tuya/snapshots/test_binary_sensor.ambr +++ b/tests/components/tuya/snapshots/test_binary_sensor.ambr @@ -48,3 +48,52 @@ 'state': 'off', }) # --- +# name: test_platform_setup_and_discovery[rqbj_gas_sensor][binary_sensor.gas_sensor_gas-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'binary_sensor', + 'entity_category': None, + 'entity_id': 'binary_sensor.gas_sensor_gas', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Gas', + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': 'tuya.ebb9d0eb5014f98cfboxbzgas_sensor_status', + 'unit_of_measurement': None, + }) +# --- +# name: test_platform_setup_and_discovery[rqbj_gas_sensor][binary_sensor.gas_sensor_gas-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'gas', + 'friendly_name': 'Gas sensor Gas', + }), + 'context': , + 'entity_id': 'binary_sensor.gas_sensor_gas', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- diff --git a/tests/components/tuya/snapshots/test_sensor.ambr b/tests/components/tuya/snapshots/test_sensor.ambr index 562f34cc8b9..ac34dc615b7 100644 --- a/tests/components/tuya/snapshots/test_sensor.ambr +++ b/tests/components/tuya/snapshots/test_sensor.ambr @@ -581,3 +581,55 @@ 'state': '100.0', }) # --- +# name: test_platform_setup_and_discovery[rqbj_gas_sensor][sensor.gas_sensor_gas-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.gas_sensor_gas', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Gas', + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'gas', + 'unique_id': 'tuya.ebb9d0eb5014f98cfboxbzgas_sensor_value', + 'unit_of_measurement': 'ppm', + }) +# --- +# name: test_platform_setup_and_discovery[rqbj_gas_sensor][sensor.gas_sensor_gas-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Gas sensor Gas', + 'state_class': , + 'unit_of_measurement': 'ppm', + }), + 'context': , + 'entity_id': 'sensor.gas_sensor_gas', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '0.0', + }) +# ---