Hi,
No idea if I am posting this in the right place, or whether it has been discussed before but I am new to the Hubitat world, and my searching found nothing useful.
I was hoping to find a way of automating certain functions based on the cost of electricity. I am on Agile Octopus, a variable energy tariff which changes cost every 30 mins, but the cost for each 30 min time period is published in advance (normally about 4pm day before). This information is available from a relatively simple API published by Octopus (API Details).
I have not been able to find a driver or app which someone else has created, and I am not a developer so not sure I would be able to create my own, but wondered if anyone has considered something like this or done something similar which I could base work on?
I've been looking for the exact same thing recently; I'm not on Octopus energy yet but am considering doing so and would like to know i can automate things intelligently based upon electricity price. IFTTT might do what i want, but i'd like to do it natively.
I've not seen any smartthings integrations that I can have a crack at porting, nor have i found any similar APIs that i can try to adapt to the specific requirements of Octopus.
I am an absolute beginner when it comes to writing drivers, so it'd be a long term project!
I wonder if between us (I am IT competent but no software developer) we can make something work if we can find a driver template which accesses an API.
I will have a search through the forums this weekend.
Took a quick look at this just to see what it was (I'm across the pond and we don't have this here).... Looks like you could use the REST API and then process the httpResponse object to get the data without too much issue. Biggest hurdle, if you haven't developed a driver yet will be get the structure in place to make/receive the calls - I'll see if there are a couple examples of this that you could use as a starting point.
I'm working my way through this, and think i have the basic structure sorted, but as I have now got to the point of trying my first API call to Octopus have realised that the httpGet does not appear to support sending HTTP Basic Auth (unless I am missing something).
Just started looking at that myself. In the params, you should be able to add an entry for headers with something like
[Authorization: Basic API-key]
as its value.
[dev:234](http://192.168.200.48/logs#pastdev234)2021-03-06 15:39:15.294 [error](http://192.168.200.48/device/edit/234)groovyx.net.http.HttpResponseException: Unauthorized on line 95 (initialize)
I'm now reading about httpGet to see what magic I can do. This is really good because when I put in a different uri I get different reponse success
Does that make it a successful failure?
So I've been doing some reading about this, and I think because Hubitat do not directly expose the http capabilities to use (hidden behind httpGet) I cannot do what I need to. I think it is the abstraction they do which is going to kill me here.
My next approach is to look at what I can do with the Octopus public API endpoints (no auth).