Hi Symcon experts,
First of all thanks for a great forum, even if I have to use Google Translate to understand anything
I am a new user of the Symcon software and have next to no programming experience so it has been a steep learning curve.
Mostly I have copy/pasted PHP scripts for my setup from the forum and other places.
I would really appriciate some help with integrating my automatic smart meter into Symcon.
In Norway we last year got smart home energy meters with automatic reading and a HAN interface for extracting data.
I have selected the Norwegian company Tibber for getting the data to the cloud since they supplied an API. Tibber Developer
It is possible to get all energy consumption data, energy prices etc.
I have found a basic PHP script for sending queries to the API but I do not know how I can write the values I get into variables for use in Symcon.
Could anyone please help with this?
This script is just for getting the hourly energy price:
$json = '{"query":"{viewer {homes {currentSubscription {priceInfo {current {total energy tax startsAt }}}}}}"}';
# Create a connection
$ch = curl_init('https://api.tibber.com/v1-beta/gql');
# Setting our options
curl_setopt($ch, CURLOPT_URL, 'https://api.tibber.com/v1-beta/gql');
curl_setopt($ch, CURLOPT_HTTPHEADER,
array('Content-Type: application/json',
'Authorization: Bearer d1007ead2dc84a2b82f0de19451c5fb22112f7ae11d19bf2bedb224a003ff74a')); // Demo token
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
# Get the response
$response = curl_exec($ch);
curl_close($ch);
echo '<pre>';
echo $json.'<br>';
echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
?>
Best regards
Andreas