Hi there,
I’m trying to retrieve my energy consumption from my Efergy electricity meter. I believe it’s close to working, but close isn’t good enough. (XXXXX is my token obfuscated).
Plain request:
http://www.energyhive.com/mobile_proxy/getCurrentValuesSummary?token=XXXX
Response:
[{“cid”:“PWER”,“data”:[{“1444632645000”:1756.97}],“sid”:“555610”,“units”:“kWm”,“age”:1}]
1756.97 is my current energy consumption.
Plan A:
Item:
Number Energy_Instant_House “Energiförbrukning [%.3f KwH]” (Allt) { http="<[http://www.energyhive.com/mobile_proxy/getCurrentValuesSummary?token=XXXXX:60000:JSONPATH($.data)]" }
Sitemap:
Text item=Energy_Instant_House label=“Energi [%d Kwh]”
Plan B:
In openhab.cfg
http:EnergyCache.http://www.energyhive.com/mobile_proxy/getCurrentValuesSummary?token=XXXXX
http:EnergyCache.updateInterval=60000
In items:
Number Energy_Instant_House_Cached “Energiförbrukning [%.3f Kwh]” { http="<[EnergyCache:60000:JSONPATH($.data)]" }
Sitemap:
Text item=Energy_Instant_House_Cached
None of them working.
events.log:
2015-10-12 08:53:07 - Energy_Instant_House state updated to [{“cid”:“PWER”,“data”:[{“1444632753000”:1642.085}],“sid”:“555610”,“units”:“kWm”,“age”:34}]
Guess it fails to retrieve the data from the response
Openhab.log
015-10-12 08:54:07.513 [ERROR] [.o.b.http.internal.HttpBinding] - transformation throws exception [transformation=JSONPATH($.data), response=[{“cid”:“PWER”,“data”:[{“1444632843000”:1625.985}],“sid”:“555610”,“units”:“kWm”,“age”:4}]]
org.openhab.core.transform.TransformationException: An error occured while transforming JSON expression.
Any pointers? It seems to me that the path to “.data.” differs from “age” but I can’t get neither to work.
/Johan