mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Add analog input value sensor for Shelly (#109312)
Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com> Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
d0384480f5
commit
b5b09446a1
@ -960,6 +960,11 @@ RPC_SENSORS: Final = {
|
|||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
|
"analoginput_xpercent": RpcSensorDescription(
|
||||||
|
key="input",
|
||||||
|
sub_key="xpercent",
|
||||||
|
name="Analog value",
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ MOCK_STATUS_COAP = {
|
|||||||
|
|
||||||
MOCK_STATUS_RPC = {
|
MOCK_STATUS_RPC = {
|
||||||
"switch:0": {"output": True},
|
"switch:0": {"output": True},
|
||||||
"input:0": {"id": 0, "state": None},
|
"input:0": {"id": 0, "state": None, "xpercent": 8.9},
|
||||||
"light:0": {"output": True, "brightness": 53.0},
|
"light:0": {"output": True, "brightness": 53.0},
|
||||||
"cloud": {"connected": False},
|
"cloud": {"connected": False},
|
||||||
"cover:0": {
|
"cover:0": {
|
||||||
|
@ -594,3 +594,13 @@ async def test_block_sleeping_update_entity_service(
|
|||||||
"Entity sensor.test_name_temperature comes from a sleeping device"
|
"Entity sensor.test_name_temperature comes from a sleeping device"
|
||||||
in caplog.text
|
in caplog.text
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def test_rpc_analog_input_xpercent_sensor(
|
||||||
|
hass: HomeAssistant, mock_rpc_device
|
||||||
|
) -> None:
|
||||||
|
"""Test RPC analog input xpercent sensor."""
|
||||||
|
entity_id = f"{SENSOR_DOMAIN}.test_name_input_0_analog_value"
|
||||||
|
await init_integration(hass, 2)
|
||||||
|
|
||||||
|
assert hass.states.get(entity_id).state == "8.9"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user