Hello, everybody. I have a problem, and I hope somebody please can help me.
Norwegian tibber uses graphQl subscription for live and accumulated power consumption-data. I would really like to get this data in to my IP-Symcon. To even out the peaks of powerconsumption in norway (typically on the morning and around dinnertime) the government and the power-companies charge extra based on maximum power consumption pr. hour. With these data I could regulate moveable consumption to minimize maximum hourly consumption. I’ve been trying to achieve this on and off for quite some time now, and I’ve gotten a few steps done. But now my (quite meagre) programming skills fall short of what I want to do.
I’ve managed to open a web socket, and connect to my smart meter, and I get valid response in the debug tab on the websocket.
The code I’ve use so far is this
$client = 34873; // the WS-client
$json = ‚{„type“:„connection_init“,„payload“:{„token“: „476c477d8a039529478ebd690d35ddd80e3308ffc49b59c65b142321aee963a4“}}‘;
WSC_SendMessage ($client, $json);
$query= ‚{„id“: „1“,„type“: „start“,„payload“: {„query“: „subscription{liveMeasurement(homeId:"c70dcbe5-4485-4821-933d-a8a86452737b"){timestamp power powerProduction accumulatedConsumption accumulatedCost}}“}}‘;
WSC_SendMessage ($client, $query);
The token and homeId are tibbers demo-tokens, not mine.
The response I get is:
05.08.2022, 15:35:48 | RECEIVED | {„type“:„connection_ack“}
05.08.2022, 15:35:51 | RECEIVED | {„type“:„data“,„id“:„1“,„payload“:{„data“:{„liveMeasurement“:{„timestamp“:„2022-08-05T15:35:52.500+02:00“,„power“:0,„powerProduction“:1386,„accumulatedConsumption“:15.955366,„accumulatedCost“:46.070754}}}}
05.08.2022, 15:35:54 | RECEIVED | {„type“:„data“,„id“:„1“,„payload“:{„data“:{„liveMeasurement“:{„timestamp“:„2022-08-05T15:35:55.000+02:00“,„power“:0,„powerProduction“:null,„accumulatedConsumption“:15.955366,„accumulatedCost“:46.070754}}}}
05.08.2022, 15:35:56 | RECEIVED | {„type“:„data“,„id“:„1“,„payload“:{„data“:{„liveMeasurement“:{„timestamp“:„2022-08-05T15:35:57.500+02:00“,„power“:0,„powerProduction“:null,„accumulatedConsumption“:15.955366,„accumulatedCost“:46.070754}}}}
etc.
What I’d like is to get access to the power powerProduction accumulatedConsumption accumulatedCost data, and get it into Symcon.
How can I do this?