Open AbsolutK opened 7 years ago
Hi!
I can try to do it, but I'll need your output to see the format in case of having a 3 phase setup. Please, replace your IP address, run the following and post the output here to see the difference between both setups.
curl -H "Content-Type: application/json" -X POST -d "admin" http://192.168.X.XXX/gateway/apipublic/logon; curl http://192.168.X.XXX/gateway/apipublic/reportInstantaneousValues
This is the output I get (already tried to rework it, but didn't succeed):
{"report":"Instantaneous values:<BR>voltage=227.6 Vrms<BR>FFTComponents:<BR>Phase 1:<BR>\tcurrent=1.068 A, activePower=168.875 W, reactivePower=175.187 var, apparentPower=243.33 VA, cosfi=69, quadrant=0, phaseshift=0.0, phaseDiff=0.0<BR>\tFFTComponents:<BR>Phase 2:<BR>\tcurrent=5.294 A, activePower=1202.691 W, reactivePower=81.095 var, apparentPower=1205.422 VA, cosfi=99, quadrant=0, phaseshift=0.0, phaseDiff=0.0<BR>\tFFTComponents:<BR>Phase 3:<BR>\tcurrent=0.968 A, activePower=150.075 W, reactivePower=161.571 var, apparentPower=220.517 VA, cosfi=68, quadrant=0, phaseshift=0.0, phaseDiff=0.0<BR>\tFFTComponents:<BR><BR>Load[726419] state[0] power: 0.0 on Sat Jan 21 16:53:31 GMT 2017<BR>Load[524671] state[0] power: 0.0 on Sun Jan 22 08:27:49 GMT 2017<BR>Load[497132] state[1] power: 1468.7 on Sun Jan 22 09:12:30 GMT 2017<BR>Load[508744] state[1] power: 150.0 on Sun Jan 22 07:46:26 GMT 2017<BR>Load[618910] state[0] power: 0.0 on Sat Jan 21 21:39:14 GMT 2017<BR>Load[679636] state[0] power: 0.0 on Sat Jan 21 08:42:20 GMT 2017<BR>Load[531881] state[0] power: 0.0 on Sat Jan 21 16:53:31 GMT 2017<BR>Load[686713] state[0] power: 0.0 on Fri Jan 20 07:59:36 GMT 2017<BR>Load[500260] state[0] power: 0.0 on Sun Jan 22 10:08:45 GMT 2017<BR>Load[508743] state[0] power: 0.0 on Sun Jan 22 02:21:53 GMT 2017<BR>Load[497131] state[0] power: 0.0 on Sun Jan 22 09:42:13 GMT 2017<BR>Load[617488] state[0] power: 0.0 on Sat Jan 21 08:01:09 GMT 2017<BR>Load[500261] state[0] power: 0.0 on Sat Jan 21 22:44:00 GMT 2017<BR>Load[513216] state[1] power: 212.1 on Sun Jan 22 07:17:53 GMT 2017<BR>Load[523371] state[1] power: 725.8 on Sat Jan 21 18:28:13 GMT 2017<BR>Load[520608] state[1] power: 10.0 on Sat Jan 21 17:02:55 GMT 2017<BR>Load[590631] state[0] power: 0.0 on Tue Jan 17 18:52:43 GMT 2017<BR>Load[520607] state[0] power: 0.0 on Sat Jan 21 12:21:40 GMT 2017<BR>Load[502872] state[1] power: 757.9 on Sun Jan 22 08:16:10 GMT 2017<BR>Load[520609] state[1] power: 23.9 on Sun Jan 22 12:09:53 GMT 2017<BR>Load[500255] state[1] power: 91.1 on Sun Jan 22 07:44:55 GMT 2017<BR>Load[510386] state[0] power: 0.0 on Sat Jan 21 22:25:56 GMT 2017<BR>Load[550940] state[0] power: 0.0 on Thu Jan 05 14:25:17 GMT 2017<BR>Load[562247] state[0] power: 0.0 on Fri Jan 13 11:50:54 GMT 2017<BR>Load[679169] state[0] power: 0.0 on Sun Jan 22 08:01:00 GMT 2017<BR>Load[510387] state[0] power: 0.0 on Mon Jan 16 07:15:36 GMT 2017<BR>Load[500256] state[1] power: 101.3 on Sat Jan 21 17:59:33 GMT 2017<BR>Load[572589] state[0] power: 0.0 on Mon Jan 16 07:45:51 GMT 2017<BR>Load[535397] state[0] power: 0.0 on Sat Jan 21 19:10:45 GMT 2017<BR>Load[513217] state[0] power: 0.0 on Sun Jan 22 11:20:16 GMT 2017<BR>Load[508739] state[1] power: 125.2 on Sun Jan 22 10:09:26 GMT 2017<BR>Load[500257] state[0] power: 0.0 on Fri Jan 20 19:20:16 GMT 2017<BR>Load[497130] state[1] power: 1344.7 on Sun Jan 22 12:02:28 GMT 2017<BR>Load[498570] state[0] power: 0.0 on Sun Jan 22 09:59:14 GMT 2017<BR>Load[517029] state[0] power: 0.0 on Sat Jan 21 12:31:37 GMT 2017<BR>Load[535573] state[0] power: 0.0 on Fri Jan 20 19:18:09 GMT 2017<BR>Load[518824] state[0] power: 0.0 on Sat Jan 21 11:05:06 GMT 2017<BR>Load[580764] state[0] power: 0.0 on Sat Jan 21 16:56:58 GMT 2017<BR>Load[495669] state[0] power: 0.0 on Fri Dec 16 11:30:01 GMT 2016<BR>Load[500254] state[0] power: 0.0 on Sun Jan 15 11:14:13 GMT 2017<BR>Load[508740] state[0] power: 0.0 on Sun Jan 22 10:16:39 GMT 2017<BR>Load[498569] state[0] power: 0.0 on Sun Jan 22 09:12:26 GMT 2017<BR>Load[495670] state[0] power: 0.0 on Sat Jan 21 18:22:27 GMT 2017<BR>Load[515504] state[0] power: 0.0 on Fri Jan 13 13:18:47 GMT 2017<BR>Load[498568] state[0] power: 0.0 on Sun Jan 22 08:25:47 GMT 2017<BR>Load[508741] state[1] power: 40.1 on Sun Jan 22 09:33:46 GMT 2017<BR>Load[508745] state[1] power: 1360.7 on Sun Jan 22 09:34:50 GMT 2017<BR>Load[741515] state[0] power: 0.0 on Sat Jan 21 14:18:42 GMT 2017<BR>Load[515505] state[0] power: 0.0 on Mon Jan 09 07:49:06 GMT 2017<BR>Load[508742] state[1] power: 689.6 on Sat Jan 21 19:21:19 GMT 2017<BR>Load[501611] state[1] power: 143.0 on Sat Jan 21 19:16:47 GMT 2017<BR>Load[500259] state[0] power: 0.0 on Fri Jan 20 19:17:18 GMT 2017<BR>Load[577069] state[0] power: 0.0 on Sat Jan 21 19:09:26 GMT 2017<BR><BR>Phase 1, peak active power 4201.283 W at 15/05/2016 08:06:45<BR>Phase 2, peak active power 6315.226 W at 12/10/2016 19:19:35<BR>Phase 3, peak active power 5519.278 W at 23/09/2016 19:26:45<BR>active energy RMS per phase mapping combination<BR>phase mapping 210=4175.399 kWh [* 1/3]<BR>phase mapping 12=3026.514 kWh [ -1/2]<BR>phase mapping 21=2544.322 kWh [ -1/0]<BR>phase mapping 102=1734.854 kWh [ 1/3]<BR>phase mapping 120=2773.407 kWh [ -1/2]<BR>phase mapping 201=1488.737 kWh [ -1/2]<BR><BR>active energy RMS (solar) per phase mapping combination<BR>phase mapping 210=0.0 kWh [* 1/3]<BR>phase mapping 12=0.0 kWh [ -1/2]<BR>phase mapping 21=0.0 kWh [ -1/0]<BR>phase mapping 102=0.0 kWh [ 1/3]<BR>phase mapping 120=0.0 kWh [ -1/2]<BR>phase mapping 201=0.0 kWh [ -1/2]<BR><BR>"}
Hi apazga, do you have any update/news on this? Thanks!
Hi @AbsolutK! Sorry, I want to find some time to check this weekend (hopefully sooner)
Hi apazga, did you have any time meanwhile? Just one sed-command would be fine, I should be able to create all other commands based on that one for sure. Thanks!
Hi! I found some time this weekend, and I almost have it ready, with other improvements I'm adding. Just a few more tests and I'll upload it. Thank you for your patience!
Update: I have it almost ready, but I need to test how the info is displayed due to Domoticz has Ampere (3 phase), voltage is the same, but I don't know about the rest of values (watts/cosfi...). I'll clean the code tomorrow and I'll upload it to a developer branch here to test it well before merging it with the master branch.
Hi apazga, thanks! Looking forward to testing this!
Many changes but it's ready to test it! Set SINGLE_PHASE=0 and DOMOTICZ_PUSH=1 in your case, and set your IDX values for the different phases, voltage and amps.
The rest of values (cosfi, reactive and apparent power) are not yet implemented for three phase until we check if this is working fine (it seems it is, testing it with your previous output). But don't worry, they are disabled now by default.
Hi apazga, thanks a lot! I've been planning to test it since Sunday, but I don't get to it. Will let you know my results soon.
I've been able to run it in debug-mode already and the output looks fine:
pi@raspberrypi:~/domoticz/scripts/smappee$ ./smappeeLocal.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 53 100 53 0 0 16 0 0:00:03 0:00:03 --:--:-- 16
{"success":"Logon successful!","header":"Logon to the monitor portal successful..."} % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3923 100 3923 0 0 2470 0 0:00:01 0:00:01 --:--:-- 2470
Domoticz push disabled. Values:
- Volts: 226.9
- Amps: 1.47;8.45;0.96
- CosPhi: 66
- Active power (watts): 310.17;1920.1;146.98
- Reactive power (var): 162.39
- Apparent power (VA): 219.03
- Watts/hour: 5.1696103;32.0018306;3.4496715
OK, perfect.
I'll add three-phase values for cosphi, reactive and apparent, and it should be all.
Right now, if you choose to push values to Domoticz:
And they will be shown in Domoticz ^_^
Update: code completed, with all parameters for Three-phase configuration too. I will be testing it a few days and if everything is OK, I'll close this issue and merge the code to the master branch ;).
Hi apazga, Your updated script is running fine, thanks! I just had to update some values as they generated sometimes an empty char, so I added 'cut -d " " -f1' behind those, because otherwise Domoticz went crazy ;-)
Hi!
Yeah, I saw it too! I'll fix it this week and merge developer into master branch,
Thanks!
Hi apazga,
The smappee can operate in different monitor modes (see the Configuration on the local smappee webportal:
I, for example, am operating with Single Phase + Solar. So P1 is my grid consumption, P2 is my solar production and in P3 I find the real calculated load of the house (P1 + P2 = P3 where P1 can be negative when my solar production is more then I consume)
I used you new dev script as base and modified it, to have the separated AMPS, like the WATTS, REACTS, APPARENTS and COSFS. Why you scripted the AMPS in a different way then the others?
Then I created the different Domoticz virtual sensors like for the Single Phase but giving them adequate names based on my smappee configuration:
Giving this result in Domoticz (values are not corresponding with above, printscreens taken on different times):
One thing that is not yet logic, is the AMP current of the grid. It is always positive and to my logic it should be negative if I'm sending current to the grid. I tried to detect if the WATTS_P1 is negative, then to make the AMPS_P1 negative, but I'm not a bash programmer and for the moment this silly 'if' is not working :-(
I think that the script could be made universal independent of the specific smappee configuration. The user should only map the xxx_P1 and/or xxx_P2 and/or xxx_P3 values if he needs too.
I can send you my changed script, but the only thing I changed is to separate the AMPS in the same way as the WATTS and the others.
@AbsolutK I'll add it and finally merge develop into master branch. @ericvb I'll give it a thought this weekend to see what can I do
Just say I didn't forgot this. I'll re-work everything this summer to support 3 phase (I have it almost ready, but have no time to finish it yet)
Thanks. If you could modify it to be more generic, depending on the smappee configuration, it would be great. :-)
Would it be possible to adapt below 3 variables into having 3 outputs for when using a 3 phase setup? Thanks!