Add charge_state to Tuya siren alarm

This commit is contained in:
epenet
2025-08-27 06:04:44 +00:00
parent 0bb16befbd
commit f9d16b227c
3 changed files with 57 additions and 1 deletions

View File

@@ -287,7 +287,13 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
), ),
# Siren Alarm # Siren Alarm
# https://developer.tuya.com/en/docs/iot/categorysgbj?id=Kaiuz37tlpbnu # https://developer.tuya.com/en/docs/iot/categorysgbj?id=Kaiuz37tlpbnu
"sgbj": (TAMPER_BINARY_SENSOR,), "sgbj": (
TuyaBinarySensorEntityDescription(
key=DPCode.CHARGE_STATE,
device_class=BinarySensorDeviceClass.BATTERY_CHARGING,
),
TAMPER_BINARY_SENSOR,
),
# Water Detector # Water Detector
# https://developer.tuya.com/en/docs/iot/categorysj?id=Kaiuz3iub2sli # https://developer.tuya.com/en/docs/iot/categorysj?id=Kaiuz3iub2sli
"sj": ( "sj": (

View File

@@ -142,6 +142,7 @@ class DPCode(StrEnum):
CH2O_VALUE = "ch2o_value" CH2O_VALUE = "ch2o_value"
CH4_SENSOR_STATE = "ch4_sensor_state" CH4_SENSOR_STATE = "ch4_sensor_state"
CH4_SENSOR_VALUE = "ch4_sensor_value" CH4_SENSOR_VALUE = "ch4_sensor_value"
CHARGE_STATE = "charge_state"
CHILD_LOCK = "child_lock" # Child lock CHILD_LOCK = "child_lock" # Child lock
CISTERN = "cistern" CISTERN = "cistern"
CLEAN_AREA = "clean_area" CLEAN_AREA = "clean_area"

View File

@@ -1175,6 +1175,55 @@
'state': 'off', 'state': 'off',
}) })
# --- # ---
# name: test_platform_setup_and_discovery[binary_sensor.siren_charging-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': None,
'entity_id': 'binary_sensor.siren_charging',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <BinarySensorDeviceClass.BATTERY_CHARGING: 'battery_charging'>,
'original_icon': None,
'original_name': 'Charging',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'tuya.okwwus27jhqqe2mijbgscharge_state',
'unit_of_measurement': None,
})
# ---
# name: test_platform_setup_and_discovery[binary_sensor.siren_charging-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'battery_charging',
'friendly_name': 'Siren Charging',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.siren_charging',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_platform_setup_and_discovery[binary_sensor.siren_tamper-entry] # name: test_platform_setup_and_discovery[binary_sensor.siren_tamper-entry]
EntityRegistryEntrySnapshot({ EntityRegistryEntrySnapshot({
'aliases': set({ 'aliases': set({