The most up to date manual I can find on using the Fluksometer dates from Mar 2013 so I suspect that some parts may now be out of date.
Specifically I am trying to call the api.flukso.net to fetch sensor readings for a water meter (which are being accurately displayed on the online dashboard).
As per the instructions in the manual, I am setting X-Version to 1.0 (& have also tried passing it as a query parameter version=1.0) but am getting a "wrong version number" error. Unfortunately I cant find any more recent documentation that confirms what the newer API version number is (I tried 1.1 :-).
See the attached. Thanks
Attachment | Size |
---|---|
api.png | 88.93 KB |
To rule out anything odd in my (Fibaro Home Center 2 Lua based) environment, I have tried curl.
Interestingly, this doesnt return a wrong version number error but an HTTP 400 Bad Request even though I believe that what I have supplied exactly matches the manual (but it is possible of course that the API has changed since then).
C:\ curl -k -v -X GET -H "Accept: application/json" -H "X-Version: 1.0" -H "X-Token: bf3ed51aeee0a5848841fe2a8826b5ec" "https://api.flukso.net/sensor/bce87f8b06951e501a14a64014e5f4c5?interval=day&unit=liter"
I am having a nice conversation with myself here :-)
I have worked out why I was getting an HTTP 400 Bad Request using curl; I was specifying an invalid unit. I was using "liter" (continental spelling) as this was one of the choices available on the dashboard. Changing this to lpermin, returned data.
So now I just need to work out why I am having issues calling the API from the Fibaro Home Center 2... (I wonder if it is something to do with HTTP protocol version?)
Just in case anyone is interested (probably not;-)
I am fairly certain that the issue I am having trying to call the Flukso API from Fibaro Home Center 2 relates to a TLS / SSL cipher issue (I think the Fibaro only supports SSL 3 and from what I can determine, Flukso.net, TLS 1.0 and it is this that results in a a handshake wrong version error.
I'm loving the commentary!
Actually everything on the Fluksometer is in lua scripts. So, if you are a command line specialist anyway, log on to the FLM via ssh and take a look for yourself. This is how I made all my stuff working... See the source section for details. It should not be too hard to find out on how to revitalize the REST api, even though I would strongly recommend to go for MQTT. A pi zero will donas man in the middle.