Volvo's PingFederate auth API now requires a POST request for the
continueAuthentication step after OTP verification. Using GET returns
the same OTP_VERIFIED state in a loop, never progressing to COMPLETED,
which causes a KeyError on 'authorizeResponse'.
Changing auth_session.get() to auth_session.post() with an empty JSON
body causes the API to return COMPLETED with the expected authorizeResponse.
Add separate sensors for TA statistics
averageFuelConsumptionAutomatic.value
averageEnergyConsumptionAutomatic.value
averageSpeedAutomatic.value
tripMeterAutomatic.value
* better logging, indicate URL used on API errors, check exceptions in more places to dont kill threads, add option for mqtt logging
* dont force token renew on 5xx errors
* indicate payload on error message to understand better issue #270
* better checking on received update_interval #270
---------
Co-authored-by: Linus Dietz <45101649+Dielee@users.noreply.github.com>
We need to be able to handle floating point numbers right on the
boundary between two icons. This means our from..to configurations must
perfectly align at each end, and the algorithm to select those must not
be both less-than-or-equal (<=) AND more-than-or-equal (>=).
After this change:
>>> get_icon_between(icon_states["battery_charge_level"], 0)
'battery-alert-variant-outline'
>>> get_icon_between(icon_states["battery_charge_level"], 9.9)
'battery-alert-variant-outline'
>>> get_icon_between(icon_states["battery_charge_level"], 10)
'battery-10'
>>> get_icon_between(icon_states["battery_charge_level"], 39)
'battery-30'
>>> get_icon_between(icon_states["battery_charge_level"], 39.9)
'battery-30'
>>> get_icon_between(icon_states["battery_charge_level"], 39.9999)
'battery-30'
>>> get_icon_between(icon_states["battery_charge_level"], 40)
'battery-40'
>>> get_icon_between(icon_states["battery_charge_level"], 99.99)
'battery-90'
>>> get_icon_between(icon_states["battery_charge_level"], 100)
'battery'
>>> get_icon_between(icon_states["battery_charge_level"], 101)
'battery'