I suggest at this point, convert the datetime from the API to a Unix timestamp (replace Z with +00:00 and use fromISO). It will save lots of strfrtime calls throughout your code and should avoid timezone issues. As a general principle, it is always best to store data with Unix timestamps.
https://github.com/markgdev/home-assistant_OctopusAgile/blob/51dba6f542304b5200f78abdbde42a99df4bcf87/OctopusAgile/Agile.py#L224
I suggest at this point, convert the datetime from the API to a Unix timestamp (replace
Z
with +00:00 and use fromISO). It will save lots ofstrfrtime
calls throughout your code and should avoid timezone issues. As a general principle, it is always best to store data with Unix timestamps.