Posts: 49
Threads: 2
Joined: Oct 2017
Reputation:
0
23.04.2021, 07:48
(This post was last modified: 23.04.2021, 07:49 by Firechief .)
When I try JSON call
http://fronius/solar_api/v1/GetMeterReal...ope=System via URL I get this response:
Code:
{
"Body" : {
"Data" : {
"0" : {
"Current_AC_Phase_1" : 3.9950000000000001,
"Current_AC_Phase_2" : -1.4910000000000001,
"Current_AC_Phase_3" : 0.82499999999999996,
"Current_AC_Sum" : 3.3289999999999997,
"Details" : {
"Manufacturer" : "Fronius",
"Model" : "Smart Meter TS 65A-3",
"Serial" : "1987314142"
},
"Enable" : 1,
"EnergyReactive_VArAC_Sum_Consumed" : 1143,
"EnergyReactive_VArAC_Sum_Produced" : 608719,
"EnergyReal_WAC_Minus_Absolute" : 176372,
"EnergyReal_WAC_Plus_Absolute" : 597616,
"EnergyReal_WAC_Sum_Consumed" : 597616,
"EnergyReal_WAC_Sum_Produced" : 176372,
"Frequency_Phase_Average" : 49.899999999999999,
"Meter_Location_Current" : 0,
"PowerApparent_S_Phase_1" : 938,
"PowerApparent_S_Phase_2" : 295.5,
"PowerApparent_S_Phase_3" : 148.09999999999999,
"PowerApparent_S_Sum" : 1381.7,
"PowerFactor_Phase_1" : 0.94499999999999995,
"PowerFactor_Phase_2" : -0.61099999999999999,
"PowerFactor_Phase_3" : 0.75700000000000001,
"PowerFactor_Sum" : 0.78900000000000003,
"PowerReactive_Q_Phase_1" : -306.5,
"PowerReactive_Q_Phase_2" : -234,
"PowerReactive_Q_Phase_3" : -96.700000000000003,
"PowerReactive_Q_Sum" : -637.39999999999998,
"PowerReal_P_Phase_1" : 886.5,
"PowerReal_P_Phase_2" : -180.40000000000001,
"PowerReal_P_Phase_3" : 112.09999999999999,
"PowerReal_P_Sum" : 818.20000000000005,
"TimeStamp" : 1619105985,
"Visible" : 1,
"Voltage_AC_PhaseToPhase_12" : 410.60000000000002,
"Voltage_AC_PhaseToPhase_23" : 415.10000000000002,
"Voltage_AC_PhaseToPhase_31" : 411.5,
"Voltage_AC_Phase_1" : 237.40000000000001,
"Voltage_AC_Phase_2" : 239.19999999999999,
"Voltage_AC_Phase_3" : 237.80000000000001
}
}
},
"Head" : {
"RequestArguments" : {
"DeviceClass" : "Meter",
"Scope" : "System"
},
"Status" : {
"Code" : 0,
"Reason" : "",
"UserMessage" : ""
},
"Timestamp" : "2021-04-22T17:39:46+02:00"
}
Maybe this helps
Novice DIY with a HL and KNX basics trying to ...
Posts: 7764
Threads: 42
Joined: Jun 2015
Reputation:
447
If you can read JSON via HTTP requests then you can use it instead of Modbus.
Posts: 49
Threads: 2
Joined: Oct 2017
Reputation:
0
Daniel stated it is better to do this with a ModBus Profile, thats why I continued with this.
Novice DIY with a HL and KNX basics trying to ...
Posts: 7764
Threads: 42
Joined: Jun 2015
Reputation:
447
What Daniel meant is that a profile should be used instead of a Modbus TCP script. If your device provides another way of supplying data then it can be used instead of Modbus.
Posts: 49
Threads: 2
Joined: Oct 2017
Reputation:
0
Can you give me an example of how to do this?
Novice DIY with a HL and KNX basics trying to ...
Posts: 7764
Threads: 42
Joined: Jun 2015
Reputation:
447
What is the URL for JSON data from the meter?
Posts: 49
Threads: 2
Joined: Oct 2017
Reputation:
0
Novice DIY with a HL and KNX basics trying to ...
Posts: 7764
Threads: 42
Joined: Jun 2015
Reputation:
447
Try this script, adjust URL and group addresses as needed. You can add extra checkupdate calls as needed.
Code:
http = require('socket.http')
json = require('json')
url = 'http://fronius/solar_api/v1/GetMeterRealtimeData.cgi?Scope=System'
resp = http.request(url)
data = json.decode(resp).Body.Data['0']
grp.checkupdate('1/1/1', data.Current_AC_Sum)
grp.checkupdate('1/1/2', data.Current_AC_Phase_1)
grp.checkupdate('1/1/3', data.Voltage_AC_Phase_1)
Posts: 49
Threads: 2
Joined: Oct 2017
Reputation:
0
I copied and modified script and created resident script with 5s interval. Modified group addresses to the correct ones and activated the script, but i don't see any updates of the group addresses. No Error logs, Logs or Alerts
Code:
http = require('socket.http')
json = require('json')
url = 'http://192.168.100.189/solar_api/v1/GetMeterRealtimeData.cgi?Scope=System'
resp = http.request(url)
data = json.decode(resp).Body.Data['0']
grp.checkupdate('33/0/1', data.Current_AC_Sum)
grp.checkupdate('33/0/2', data.Current_AC_Phase_1)
grp.checkupdate('33/0/3', data.Current_AC_Phase_2)
grp.checkupdate('33/0/4', data.Current_AC_Phase_3)
grp.checkupdate('33/0/5', data.Voltage_AC_PhaseToPhase_12)
grp.checkupdate('33/0/6', data.Voltage_AC_PhaseToPhase_23)
grp.checkupdate('33/0/7', data.Voltage_AC_PhaseToPhase_31)
grp.checkupdate('33/0/8', data.Voltage_AC_Phase_1)
grp.checkupdate('33/0/9', data.Voltage_AC_Phase_2)
grp.checkupdate('33/0/10', data.Voltage_AC_Phase_3)
Novice DIY with a HL and KNX basics trying to ...
Posts: 4646
Threads: 24
Joined: Aug 2017
Reputation:
207
This is sent only on change of value
------------------------------
Ctrl+F5
Posts: 7764
Threads: 42
Joined: Jun 2015
Reputation:
447
Add some extra logging and post what you get in Logs tab:
Code:
http = require('socket.http')
json = require('json')
url = 'http://192.168.100.189/solar_api/v1/GetMeterRealtimeData.cgi?Scope=System'
resp, code = http.request(url)
log(resp, code)
data = json.decode(resp).Body.Data['0']
log(data)
grp.checkupdate('33/0/1', data.Current_AC_Sum)
grp.checkupdate('33/0/2', data.Current_AC_Phase_1)
grp.checkupdate('33/0/3', data.Current_AC_Phase_2)
grp.checkupdate('33/0/4', data.Current_AC_Phase_3)
grp.checkupdate('33/0/5', data.Voltage_AC_PhaseToPhase_12)
grp.checkupdate('33/0/6', data.Voltage_AC_PhaseToPhase_23)
grp.checkupdate('33/0/7', data.Voltage_AC_PhaseToPhase_31)
grp.checkupdate('33/0/8', data.Voltage_AC_Phase_1)
grp.checkupdate('33/0/9', data.Voltage_AC_Phase_2)
grp.checkupdate('33/0/10', data.Voltage_AC_Phase_3)
Posts: 49
Threads: 2
Joined: Oct 2017
Reputation:
0
23.04.2021, 09:25
(This post was last modified: 23.04.2021, 09:28 by Firechief .)
These values should change all the time as it's solar production and energy consumption.
What I want to monitor is real time (5-10s interval) data coming from the inverter and Smart Energy Meter so I can make a dashboard on the visu and maybe in the future actions depending on production or consumption.
this is the log:
Code:
Wiser for KNXLogoutStart pageLanguage:
English
1
Version: 2.5.1
CPU/IO: 0.12 0.06 0.08, Memory: 21%, KNX/TP: OK
* table:
["Current_AC_Phase_1"]
* number: 1.312
["PowerReal_P_Phase_1"]
* number: 190.8
["PowerFactor_Phase_1"]
* number: 0.796
["PowerReal_P_Sum"]
* number: -53.6
["Current_AC_Sum"]
* number: 0.434
["PowerFactor_Phase_3"]
* number: 0.328
["PowerReal_P_Phase_2"]
* number: -283.6
["PowerReactive_Q_Phase_3"]
* number: -112.7
["EnergyReactive_VArAC_Sum_Produced"]
* number: 614904
["Current_AC_Phase_2"]
* number: -1.412
["PowerApparent_S_Sum"]
* number: 654.4
["TimeStamp"]
* number: 1619170026
["Voltage_AC_PhaseToPhase_23"]
* number: 416.4
["EnergyReal_WAC_Sum_Produced"]
* number: 176646
["PowerFactor_Phase_2"]
* number: -0.961
["Current_AC_Phase_3"]
* number: 0.534
["PowerFactor_Sum"]
* number: -0.156
["PowerReactive_Q_Phase_2"]
* number: -81.9
["Voltage_AC_Phase_2"]
* number: 240.5
["EnergyReal_WAC_Minus_Absolute"]
* number: 176646
["Meter_Location_Current"]
* number: 0
["Voltage_AC_Phase_3"]
* number: 238
["EnergyReactive_VArAC_Sum_Consumed"]
* number: 1143
["Voltage_AC_Phase_1"]
* number: 238.7
["PowerApparent_S_Phase_2"]
* number: 295.2
["EnergyReal_WAC_Sum_Consumed"]
* number: 602167
["Visible"]
* number: 1
["Voltage_AC_PhaseToPhase_31"]
* number: 412.8
["Voltage_AC_PhaseToPhase_12"]
* number: 412.8
["Frequency_Phase_Average"]
* number: 50
["PowerApparent_S_Phase_3"]
* number: 119.3
["Details"]
* table:
["Manufacturer"]
* string: Fronius
["Model"]
* string: Smart Meter TS 65A-3
["Serial"]
* string: 1987314142
["Enable"]
* number: 1
["PowerReactive_Q_Sum"]
* number: -339.9
["EnergyReal_WAC_Plus_Absolute"]
* number: 602167
["PowerApparent_S_Phase_1"]
* number: 239.7
["PowerReactive_Q_Phase_1"]
* number: -145.1
["PowerReal_P_Phase_3"]
* number: 39.2
Novice DIY with a HL and KNX basics trying to ...
Posts: 49
Threads: 2
Joined: Oct 2017
Reputation:
0
The log shows it updates every 5s but values in the group addresses are not updated.
Tried grp.update instead of grp.checkupdate, but no change.
Novice DIY with a HL and KNX basics trying to ...
Posts: 4646
Threads: 24
Joined: Aug 2017
Reputation:
207
What datatypes do you use for your objects?
------------------------------
Ctrl+F5
Posts: 49
Threads: 2
Joined: Oct 2017
Reputation:
0
23.04.2021, 12:54
(This post was last modified: 23.04.2021, 12:55 by Firechief .)
Daniel,
14. 4-byte floating point in HL Objects, but manual states that they are int16 and some acc32?
I'm trying like this now in the script:
Code:
grp.update('34/0/1', (data.Current_AC_Sum) ,dt.float16) -- Totaal vermogen (A)
grp.update('33/0/2', (data.Current_AC_Phase_1) ,dt.float16) -- Stroom L1 (A)
grp.update('33/0/3', (data.Current_AC_Phase_2) ,dt.float16) -- Stroom L2 (A)
grp.update('33/0/4', (data.Current_AC_Phase_3) ,dt.float16) -- Stroom L3 (A)
grp.update('34/0/5', (data.Voltage_AC_PhaseToPhase_12) ,dt.float32) -- Spanning L1-L2 (V)
grp.update('33/0/6', (data.Voltage_AC_PhaseToPhase_23) ,dt.float32) -- Spanning L2-L3 (V)
grp.update('33/0/7', (data.Voltage_AC_PhaseToPhase_31) ,dt.float32) -- Spanning L3-L1 (V)
grp.update('34/0/8', (data.Voltage_AC_Phase_1) ,dt.float32) -- Spanning L1-N (V)
grp.update('33/0/9', (data.Voltage_AC_Phase_2) ,dt.float32) -- Spanning L2-N (V)
grp.update('33/0/10', (data.Voltage_AC_Phase_3) ,dt.float32) -- Spanning L3-N (V)
and in HL Objects:
group 1-4: 2 byte floating point
group 5-10: 4 byte floating point.
This gives the correct values in HL, but still no auto update of those groups.
Novice DIY with a HL and KNX basics trying to ...
Posts: 7764
Threads: 42
Joined: Jun 2015
Reputation:
447
Use float32 for instantaneous values like voltage, current etc, use int64 for counter values. What is stated in the manual does not matter because you are not reading via Modbus.
Posts: 49
Threads: 2
Joined: Oct 2017
Reputation:
0
Thx,
Rebooted the HL and now everything is updating. thx for the help.
Novice DIY with a HL and KNX basics trying to ...
Posts: 9
Threads: 1
Joined: Dec 2021
Reputation:
0
03.12.2021, 20:33
(This post was last modified: 06.02.2022, 07:41 by mxcxpx .)
attached find my json
Attached Files
Posts: 7764
Threads: 42
Joined: Jun 2015
Reputation:
447
Check this:
http://www.fronius.com/QR-link/0006
Otherwise ask Fronius support directly. This is not something that we can help you with.
Posts: 9
Threads: 1
Joined: Dec 2021
Reputation:
0
(23.04.2021, 07:52) admin Wrote: If you can read JSON via HTTP requests then you can use it instead of Modbus.
for me this works to
http://IP of inverter/solar_api/v1/GetPowerFlowRealtimeData.fcgi
but how to implement in LogicMchine.
sorry iam new and have to learn by doing.
thanks