Skip to content

Commit

Permalink
sanitize string sensor values
Browse files Browse the repository at this point in the history
* trim left and right spaces
* remove duplicated spaces between words
* example: "    HP  BLEU    " -> "HP BLEU"
  • Loading branch information
ggrandou committed Jul 7, 2024
1 parent d8a210b commit c3695e0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion custom_components/linkytic/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1512,7 +1512,8 @@ def update(self):
)
self._attr_available = True
# Save value
self._last_value = value
# remove useless spaces
self._last_value = ' '.join(value.split())


class RegularIntSensor(SensorEntity):
Expand Down

0 comments on commit c3695e0

Please sign in to comment.