mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Add illuminance sensor for Shelly gen2 devices (#93559)
This commit is contained in:
parent
f5358d3863
commit
eb058a3d41
@ -584,6 +584,14 @@ RPC_SENSORS: Final = {
|
|||||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
entity_registry_enabled_default=False,
|
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(
|
"temperature": RpcSensorDescription(
|
||||||
key="switch",
|
key="switch",
|
||||||
sub_key="temperature",
|
sub_key="temperature",
|
||||||
|
@ -190,6 +190,7 @@ MOCK_STATUS_RPC = {
|
|||||||
"apower": 85.3,
|
"apower": 85.3,
|
||||||
},
|
},
|
||||||
"temperature:0": {"tC": 22.9},
|
"temperature:0": {"tC": 22.9},
|
||||||
|
"illuminance:0": {"lux": 345},
|
||||||
"sys": {
|
"sys": {
|
||||||
"available_updates": {
|
"available_updates": {
|
||||||
"beta": {"version": "some_beta_version"},
|
"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
|
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(
|
async def test_rpc_sensor_error(
|
||||||
hass: HomeAssistant, mock_rpc_device, monkeypatch
|
hass: HomeAssistant, mock_rpc_device, monkeypatch
|
||||||
) -> None:
|
) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user