You can run the octopusagile.half_hour service and it will populate. I will put an issue in github too as it would be better if it just ran itself on first run or stored the info and reloads after a restart as it does for some of the other data it generates.
Appreciate it. Thank you.
As a beginner, Ive just managed to set up an automation to start my car charging when prices go negative - Ive tested it and it works! negative prices tonight too so brilliant timing.
As a beginner Im really pleased Ive managed to get something like this working!
Could you let me know how exactly this can be done? I looked at the powerwall integration but cannot see anywhere to change the mode.
Sounds awesome, would you mind sharing what you did to achieve it? Like you and as a beginner this is all a bit confusing!! I want to be able to do what you have for the car charging and powerwall. Thanks
So managed to work out how to get the powerwall switching mode on an automation, very powerful stuff this integration!
@im85288 glad you worked out it, sorry busy weekend. FYI its always worth posting how you solve the problems so others looks at this know how. For anyone interested the component is in post 6 on this thread: Add support for Tesla Powerwall
Once you have that setup you can add an automation to run the following:
and the reverse (backup) to get it to pull from the grid. If you mix and match this with @badguy example you should be able to get something working.
Mine is currently a mess, and not active as i still need my smart meter installed (seems to be taken forever, even if you dont take Covid into account). Once done and working i will post the full setup. Any questions on the above, happy to help.
Hi, Im having an issue using the octocost module and displaying the monthly usage and cost. An error appears to occur in the cost calculations when octopus have missing periods of data.
Ive tried following the code, but cant see what happens if the usage data from API has missing periods.
Further info below:
It pulls and shows the figures as expected, however it seemed a little off, so I pulled the data myself from the octopus api, and laid it out in exel - I can see that the usage shown by octocost is exactly right.
This tells me that octocost is fetching the usage from the correct start date and adding usage up correctly.
The cost however is quite a way out. It is showing as £17.23 - however when I put the agile rates alongside my usage in excel and do the relevant usage * price = cost, and sum up all the cells, the actual cost is £7.72.
I think, having tried differing start dates in the octocost settings and comparing results with that from my spreadsheet I can see that octopus has a day of missing data (16th June). If I put my start date as 17th june, everything shows correctly.
If I put the start date as 16th June (so it includes the day that octopus has missing according to the API), then octocost adds a random £9.50 for that day or about 19p per time period.
If I set the start date correctly to 6th June, this error persists and it appears to be adding a large amount of 19p per time period for any periods that the octopus API has no data.
It doesn’t cope with missing data, it’s a bit rough and ready. I probably need to give it a bit of time, but if you’ve got any pull requests for fixes, feel free to submit them.
I think (I haven’t looked at this for quite a while), that it just tries to line up the start point, allowing for daylight saving, then rattles through the data line by line, multiplying use by cost, so may get out of sync if lines are missing completely rather than being zero.
I’ll try and take a look next weekend. I want to work on https://github.com/badguy99/octocost/issues/4 anyway, as the gas tracker info isn’t in the normal API, so I have to get that from elsewhere.
Ah right - Im not very goog at coding, in fact pretty useless if Im honest. That much of a beginner I dont know what you mean by “pull requests for fixes”.
Yes - if it shuffles up data to fill lines that would explain it as Ive hammered my usage during negative price periods, as these periods wouldnt be negative if moved by 24 hours that would explain the large shift.
Id like to be able to write a simple script to pull my usage data into a csv, and similarly prics for the same period, but as above coding skills arent anywhere at that level yet.
Cool, no worries, I’ll hopefully look at it on the weekend, and come on with a solution.
@Markg - are the rates one hour behind for you? Looks to me like the timezone is GMT but not adjusted for summer time (GMT+1)
Hi @im85288, is the the rates card that is one hour behind for you? For me it’s good, everything else is shown as GMT rather than BST, I need to revisit to get all the sensors to either query the octopus API for BST or convert times before storing them. The javascript in the rates card should convert to local time for you though…
@Markg - It was the data shown in the developer section where I noticed it being an hour behind rather than visually (as I have not tried the rated card yet). What I was attempting to do was trigger a timer on a custom switch…but never see it having its value changed to “on”. This lead me to think maybe it was because the timings were out. I re-installed everything but now there’s no rates data at all. I’ll give it another try tomorrow when hopefully the rates data is there. Am I correct in thinking the timer should trigger a custom toggle switch (Helpers-> Toggle)?
Ah yes that makes sense that they would show as GMT then, they should get triggered based on GMT times too though. I haven’t checked, can the toggle switch be managed with the home assistant.turn_on/turn_off service? That’s what it’s making use of.
In terms of the missing data, it should catch up over time, the timers get updated at 1900 each day, and keep trying every hour if they fail (like yesterday when the rates didn’t come in until late) and the rates and timer management runs on every half hour. If you don’t want to wait after a restart you can manually call the octopusagile.update_timers and octopusagile.half_hour service to update everything.
With a fresh head I had another look today and Yes like you mention they do get triggered based on GMT too so all works well…but it also means in the timer config you need to use GMT (this caught me out at first…once you know this it’s fine of course).
As for the Input Boolean I had to alter the code to set it on/off as it’s not a switch for example: hass.services.call('input_boolean', 'turn_on', {'entity_id': entity_id})
Maybe I could have created a switch instead but the guides led me to think a Input Boolean was what I needed here. FYI, I will use this ON/OFF to control things like charging the car/powerwall at the best prices during the night.
The “missing data” was actually there…it just didn’t show up in portrait mode on my iPad!
Everything is working fine now, thanks for putting it out there
Really pleased you got it working. I have issues open On github for both the GMT thing and adding the ability to call whichever service you like but just haven’t been able to spend the time on it lately.
Great to here how you’re planning to use it for the car/powerwall!
@Markg, IIRC, the raw Agile data has “Z” as the timezone. Python cannot handle a timezone specified as “Z”. You need to replace the “Z” in the datetime string with “+00:00” before using fromisoformat
so Python interprets it correctly. If not, it will treat the time received as ‘local’ time. It is a ‘feature’ not a ‘bug’.
Hi, I’m very new to HA but I’m pleased to see a few names here which I recognise from the Octopus forum.
I recently managed to get Badguy’s Octoblock working and I can now configure it. I’ve been thinking of useful things I can do with it (apart from the obvious) and one not-so-useful is I’d like to try is adjusting the colour of a light depending on current Agile cost, maybe ultimately on a graduating scale but initially green, yellow, red would do. So sort the day’s prices into order and each third gets a different colour. (I realise there are other approaches I could make).
Having scouted the forum for help I think I’m maybe trying to run before I can walk but I just thought I’d post here in case anyone has done anything similar. (In my mind this will be the pre-cusrsor for other things).
What on earth is going on with Agile rates.
I calculated my cost per day about 2 months ago and did so again today - it has increased three fold with no significant changes here . There are almost no green rates now and no blue at all. Peak rate is 35p KW/hr
Beware…
Others can explain it better but there is nowhere near as much nuclear online for one reason or another right now, and as a result supply is more closely matched to demand, so the Agile prices will be higher than they were.
The weekend ought to be cheaper and I am hoping it generally gets a bit cheaper (otherwise I’ll change tariffs!) but it is still quite comfortably beating all other Octopus tariffs over (say) a month.