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>
This commit is contained in:
parent
d4489faa68
commit
73cd03255f
1 changed files with 4 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue