Correct setup of system_bridge sensors (#55442)

This commit is contained in:
Erik Montnemery 2021-08-30 12:06:24 +02:00 committed by GitHub
parent 1060630bbd
commit 8faec3da8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -376,7 +376,7 @@ async def async_setup_entry(
state_class=STATE_CLASS_MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
icon="mdi:percent",
value=lambda bridge: round(
value=lambda bridge, index=index: round(
bridge.processes.load.cpus[index].load, 2
),
),
@ -390,7 +390,7 @@ async def async_setup_entry(
state_class=STATE_CLASS_MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
icon="mdi:percent",
value=lambda bridge: round(
value=lambda bridge, index=index: round(
bridge.processes.load.cpus[index].loadIdle, 2
),
),
@ -404,7 +404,7 @@ async def async_setup_entry(
state_class=STATE_CLASS_MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
icon="mdi:percent",
value=lambda bridge: round(
value=lambda bridge, index=index: round(
bridge.processes.load.cpus[index].loadSystem, 2
),
),
@ -418,7 +418,7 @@ async def async_setup_entry(
state_class=STATE_CLASS_MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
icon="mdi:percent",
value=lambda bridge: round(
value=lambda bridge, index=index: round(
bridge.processes.load.cpus[index].loadUser, 2
),
),