metbosch / homebridge-http-temperature

HomeBridge HomeKit Plugin for HTTP temperature endpoints
https://www.npmjs.com/package/homebridge-http-temperature
Apache License 2.0
33 stars 18 forks source link

Remove unwanted characters from the input #33

Closed andresindlp closed 2 years ago

andresindlp commented 2 years ago

When the data given is for example "45.0 ºC" it doesn't work.

With value_str = value_str.replace(/[^0-9.]/g, '');, everything but numbers and the dot are removed, leaving a clean output.

metbosch commented 2 years ago

Thanks for the contribution. I would publish a new version in npmjs soon with this changes.