This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Json API - Sonnen Battery
#1
Hello there,

we want to integrate the "Sonnen" API to the Logicmachine.
We dont know how to implement this.
Can anyone help us please.
The settings we are see is this:

   

The documentation is attatched.

Thank you
Kind regards
Simon Epp

Attached Files
.pdf   sonnenBatterie API.pdf (Size: 921.1 KB / Downloads: 14)
.json   openapi.json (Size: 38.71 KB / Downloads: 5)
Reply
#2
Try this:
Code:
token = 'abcdef'
url = 'http://192.168.1.1/api/v2/latestdata'

resp, code, hdrs, stat = require('socket.http').request({
  url = url,
  method = 'GET',
  headers = {
    ['Auth-Token'] = token
  },
})

if code == 200 then
  data = require('json').pdecode(resp)

  log(data)

  consumption = data['Consumption_W']
  production = data['Production_W']
  state = data['ic_status']['statebms']

  log(consumption, production, state)
else
  log('request failed', resp, code)
end
Reply
#3
Thanks admin,

works great like always.

Smile
Reply


Forum Jump: