Skip to content

Commit

Permalink
Add luminance sensor to "pir" category #243
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou committed May 20, 2024
1 parent 6e345fc commit 6de966c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions custom_components/localtuya/core/ha_entities/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,9 @@ class DPCode(StrEnum):
HUM_PERIODIC_REPORT = "hum_periodic_report"
HUM_SENSITIVITY = "hum_sensitivity"
IDU_ERROR = "idu_error"
ILLUMINANCE_VALUE = "illuminance_value"
INNERDRY = "innerdry"
INTERVAL_TIME = "interval_time"
IPC_WORK_MODE = "ipc_work_mode"
IR_SEND = "ir_send"
IR_STUDY_CODE = "ir_study_code"
Expand Down
7 changes: 7 additions & 0 deletions custom_components/localtuya/core/ha_entities/numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,13 @@ def localtuya_numbers(_min, _max, _step=1, _scale=1, unit=None) -> dict:
name="Light level",
custom_configs=localtuya_numbers(0, 981, 1, 1, "lx"),
),
LocalTuyaEntity(
id=DPCode.INTERVAL_TIME,
icon="mdi:timer-sand-complete",
entity_category=EntityCategory.CONFIG,
name="Interval",
custom_configs=localtuya_numbers(1, 720, 1, 1, UnitOfTime.MINUTES),
),
),
# Robot Vacuum
# https://developer.tuya.com/en/docs/iot/fsd?id=K9gf487ck1tlo
Expand Down
7 changes: 7 additions & 0 deletions custom_components/localtuya/core/ha_entities/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,13 @@ def localtuya_sensor(unit_of_measurement=None, scale_factor: float = 1) -> dict:
entity_category=EntityCategory.DIAGNOSTIC,
custom_configs=localtuya_sensor("s"),
),
LocalTuyaEntity(
id=DPCode.ILLUMINANCE_VALUE,
name="Illuminance",
entity_category=EntityCategory.DIAGNOSTIC,
device_class=SensorDeviceClass.ILLUMINANCE,
state_class=SensorStateClass.MEASUREMENT,
),
*BATTERY_SENSORS,
),
# PM2.5 Sensor
Expand Down

0 comments on commit 6de966c

Please sign in to comment.