In case anyone wants to look at a specific binding the API is here:
Might be OH4 specific, but hopefully it helps someone else. The start of the rateChange rule needs to be changed to the following.
The old code line no longer worked, and caused the hour
variable on the following line to be set to the first 2 digits of the year, 2024 = 20
val String dateString = String::format( "%1$tH:%1$tM", new java.util.Date ) //get current hour as a string
Just wanted to share my date approach in case others are interested.
At the top
import java.time.format.DateTimeFormatter
Before the rules:
val DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("YYYY-MM-dd")
val DateTimeFormatter dayFormatter = DateTimeFormatter.ofPattern("dd")
val DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm")
Various date-to-string methods use the format:
val String dateString = now(ZoneId.of( "UTC")).format(dateFormatter)
val String today$ = now(ZoneId.of( "UTC")).format(dayFormatter)
etc etc…
Also, the url I’m using, in Yorkshire, is:
https://api.octopus.energy/v1/products/AGILE-24-04-03/electricity-tariffs/E-1R-AGILE-24-04-03-M/standard-unit-rates
You can find your agile version on the main products API: https://api.octopus.energy/v1/products/
The -M bit was found here: Meter Point Administration Number - Wikipedia
but calling the API to get the exact tarriff on your meter would be best.
I’m still not sure what “E-1R-” means, but it seems to work!
Good luck!
Hi all. This has stopped working for me. Could someone post their working setup please. Thanks in advance.
I posted a solution here that’s still working for me. Hope it helps. Feel free to ask me any questions.