Skip to content

Commit

Permalink
Prevent Python 3.12 SyntaxWarning in HA 2024.2 and above (due to the …
Browse files Browse the repository at this point in the history
…quoted Unicode string using unknown escape characters)
  • Loading branch information
goakes committed Mar 3, 2024
1 parent 7fffecb commit b4ff10e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/redback/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ def _handle_coordinator_update(self) -> None:
measurement = 0
# dynamically calculated power measurement
if self.data_source.startswith('$calc$'):
measurement = re.sub('^\$calc\$\s*', '', self.data_source)
measurement = re.sub(r'^\$calc\$\s*', '', self.data_source)
ed = self.coordinator.energy_data
measurement = float(eval(measurement, {'ed':ed}))

Expand Down

0 comments on commit b4ff10e

Please sign in to comment.