Closed gcoan closed 3 months ago
Hello. Sorry that you've encountered this. This was an issue with loading the configuration around the minimum/maximum rates and should be fixed in v12.2.1.
as per https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/discussions/957 I don’t see there is any value in storing the account id, mpan or tariff code for the found price slots in the target rate sensors. All of these should be pretty explicit by the context you created it. Possibly you need to retain the mpan or at least some form of representation of whether its import or export that the target rate sensor applies to, but otherwise, no point in keeping the others, especially repeating the tariff code.
The attributes on the target rate sensor are useful for debugging (both for end users and for myself when bugs are raised), so I don't see any of these going away. As outlined in the linked issue, they may be removed from being saved to the database to reduce storage, but want to gain feedback from people before I do this. I suspect no one is using the data in this context, but want to make sure first.
think the documentation needs to be clearer about the units of maximum and minimum thresholds for the target rate sensor. I assumed they were pence, so hence put 13, but when I see the output that the average/min/max cost are in pounds, then maybe the min and max need to be in pounds as well (i.e. 0.13)? Not clear in the documentation
I've updated the docs and added further clarification to the config screens.
I found that there’s a limitation of the target rate sensor is that it has to be in half hour increments, e.g. 1.5 hours. I first configured it as 1.33 hours as the washing machine runs for 1:20, and so the most optimum time could be 10 minutes in to a half hour slot, so using 20 minutes of that slot and 2 full further slots. Its not a major limitation to enforce the half hour configurability (but would be nice if it wasn’t a limit), but suggest this needs to be made explicit
This is by design as all rates are in 30 minute increments, so made no sense to go any lower. I also originally didn't know how the sensor is being used (before weightings existed), so in that I would be making an abitary decision on which block the fraction of slot would be assigned to (the 20 minutes might be most power hungry time or the least power hungry time). There are no plans to change this behaviour.
The error message is quite clear on the format if a user picks an invalid configuration, however I've updated the docs and screens with this limitation as well.
Thanks Dave for the comprehensive replies. I can see the documentation updates and look forward to seeing v12.2.1 for the config fix.
Definitely get my vote on reducing the database size by removing unnecessary state attributes.
The sensor seems to work well. At the moment I am using Octoblock (within AppDaemon) and some complicated Jinja template code within the dashboard to work out when to turn the washing machine and dishwasher on for the cheapest rate. Made more complicated by the washing machine needs an end time (finish in X hours time) whereas the dishwasher wants a delay start (delay start for Y hours). My aim is to retire using Octoblock and to move this all to using the integration's target rate triggers.
Installed 12.2.1, has fixed the 'unexpected str' error and I am now able to reconfigure the target rate sensor multiple times. Thank you. I notice that the configuration screen is now clearer as well as to the units for max min rate etc.
One oddity, the average price etc attributes were I think rounded in the prior release whereas now they are being populated with a lot of decimal places:
overall_average_cost: 0.02562 overall_min_cost: 0.010815 overall_max_cost: 0.046305 current_duration_in_hours: 0 next_time: 2024-08-27T10:30:00+01:00 next_duration_in_hours: 1.5 next_average_cost: 0.02562 next_min_cost: 0.010815 next_max_cost: 0.046305
I suppose extra decimal places are needed as Octopus rates are pence and 2 decimal places, but it looks as if there could be a bit of rounding applied as there's 4dp of pence? e.g.
next_min_cost: 0.0108 next_max_cost: 0.0463
Nothing was changed in this release around the cost attributes, so it's probably that the rates that were picked resulted in more decimal places.
Rounding is a contentious subject, as there are mixed opinions among people who use this integration. Anything around prices/rates are typically rounded to 5dp to match how rates are reported by OE. Anything around costs are rounded to 2dp. However it looks like these sensors have been missed. See https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/discussions/913.
As the original issue has been solved, I'll close this ticket.
Yeah I appreciate the dp will be contentious and different people will want different roundings and the approach taken seems sensible. Assume you will you pickup rounding on these sensors as part of backlog?
Another minor rounding observation:
target_times_last_evaluated: 2024-08-27T07:20:32.025006+01:00
No need to have microseconds in the time! Start, end and next time all don't have 😉
Yeah the rounding on these attributes will be fixed on way or another in the future, but it won't be resolved any time soon I'm afraid (I'm away for a few weeks).
The inclusion of milliseconds is down to the rate time reported by OE vs the time reported by HA to the integration. I'll remove the milliseconds if it's an easy fix across the board, but can't say it's high on my priority list :)
Describe the bug
Created a new target rate sensor last night, which works as correctly:
But when I went to make changes to the configuration, I get an ‘expected str’ error.
Cancel the changes, go back in to configure the target rate sensor, press confirm (no changes), and same thing happens
Reproduction steps
Configure a target rate sensor. I had 1.5 hours from 16:00 to 16:00, max price 13. Let the sensor populate.
Try to reconfigure the sensor, press commit get the error.
NB: Not sure the trigger cause of this error because when I first set the target rate sensor up I had set min price 13 but the sensor didn’t populate any expected times. Changed it to max price 13 and it then populated times as expected. Only now when I try to reconfigure it I can’t.
Expected behaviour
Able to reconfigure target rate sensors at any time.
Additional comments/observations:
Tariff Code
E-1R-AGILE-23-12-06-A
Integration Version
12.2.0
Home Assistant Version
2024.8.1
Fresh Install?
Not specified
Home Assistant Logs
Debug log for Octopus integration whilst triggering the error although I don’t know if this shows anything, looks like regular polling:
Confirmation