Ignore empty payloads from DSMR Reader (#86841)
* Ignore empty payloads from DSMR Reader * Simplify empty payload handling If the native value hasn't changed, requesting to store it won't have a performance impact. Co-authored-by: Franck Nijhof <frenck@frenck.nl> --------- Co-authored-by: Franck Nijhof <frenck@frenck.nl>pull/86970/head
parent
d4489faa68
commit
73cd03255f
|
@ -69,7 +69,10 @@ class DSMRSensor(SensorEntity):
|
|||
@callback
|
||||
def message_received(message):
|
||||
"""Handle new MQTT messages."""
|
||||
if self.entity_description.state is not None:
|
||||
if message.payload == "":
|
||||
self._attr_native_value = None
|
||||
elif self.entity_description.state is not None:
|
||||
# Perform optional additional parsing
|
||||
self._attr_native_value = self.entity_description.state(message.payload)
|
||||
else:
|
||||
self._attr_native_value = message.payload
|
||||
|
|
Loading…
Reference in New Issue