Explicit check for None in Discovergy entity if condition (#105248)

Fix checking for None in Discovergy
This commit is contained in:
Jan-Philipp Benecke 2023-12-07 19:47:14 +01:00 committed by GitHub
parent 83a1ca5e83
commit dd902bc956
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 3 deletions

View file

@ -183,6 +183,7 @@ async def async_setup_entry(
for description in sensors
for value_key in {description.key, *description.alternative_keys}
if description.value_fn(coordinator.data, value_key, description.scale)
is not None
)
async_add_entities(entities)

View file

@ -67,7 +67,7 @@ LAST_READING = Reading(
"energyOut": 55048723044000.0,
"energyOut1": 0.0,
"energyOut2": 0.0,
"power": 531750.0,
"power": 0.0,
"power1": 142680.0,
"power2": 138010.0,
"power3": 251060.0,

View file

@ -61,7 +61,7 @@
'energyOut': 55048723044000.0,
'energyOut1': 0.0,
'energyOut2': 0.0,
'power': 531750.0,
'power': 0.0,
'power1': 142680.0,
'power2': 138010.0,
'power3': 251060.0,

View file

@ -132,7 +132,7 @@
'entity_id': 'sensor.electricity_teststrasse_1_total_power',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': '531.75',
'state': '0.0',
})
# ---
# name: test_sensor[gas last transmitted]