Add illuminance sensor for Shelly gen2 devices (#93559)
This commit is contained in:
parent
f5358d3863
commit
eb058a3d41
3 changed files with 19 additions and 0 deletions
|
@ -584,6 +584,14 @@ RPC_SENSORS: Final = {
|
|||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
entity_registry_enabled_default=False,
|
||||
),
|
||||
"illuminance": RpcSensorDescription(
|
||||
key="illuminance",
|
||||
sub_key="lux",
|
||||
name="Illuminance",
|
||||
native_unit_of_measurement=LIGHT_LUX,
|
||||
device_class=SensorDeviceClass.ILLUMINANCE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
"temperature": RpcSensorDescription(
|
||||
key="switch",
|
||||
sub_key="temperature",
|
||||
|
|
|
@ -190,6 +190,7 @@ MOCK_STATUS_RPC = {
|
|||
"apower": 85.3,
|
||||
},
|
||||
"temperature:0": {"tC": 22.9},
|
||||
"illuminance:0": {"lux": 345},
|
||||
"sys": {
|
||||
"available_updates": {
|
||||
"beta": {"version": "some_beta_version"},
|
||||
|
|
|
@ -274,6 +274,16 @@ async def test_rpc_sensor(hass: HomeAssistant, mock_rpc_device, monkeypatch) ->
|
|||
assert hass.states.get(entity_id).state == STATE_UNKNOWN
|
||||
|
||||
|
||||
async def test_rpc_illuminance_sensor(
|
||||
hass: HomeAssistant, mock_rpc_device, monkeypatch
|
||||
) -> None:
|
||||
"""Test RPC illuminacne sensor."""
|
||||
entity_id = f"{SENSOR_DOMAIN}.test_name_illuminance"
|
||||
await init_integration(hass, 2)
|
||||
|
||||
assert hass.states.get(entity_id).state == "345"
|
||||
|
||||
|
||||
async def test_rpc_sensor_error(
|
||||
hass: HomeAssistant, mock_rpc_device, monkeypatch
|
||||
) -> None:
|
||||
|
|
Loading…
Add table
Reference in a new issue