mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
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
@ -69,7 +69,10 @@ class DSMRSensor(SensorEntity):
|
|||||||
@callback
|
@callback
|
||||||
def message_received(message):
|
def message_received(message):
|
||||||
"""Handle new MQTT messages."""
|
"""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)
|
self._attr_native_value = self.entity_description.state(message.payload)
|
||||||
else:
|
else:
|
||||||
self._attr_native_value = message.payload
|
self._attr_native_value = message.payload
|
||||||
|
Loading…
x
Reference in New Issue
Block a user