Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shelly 2.5 - dual power metering #6160

Closed
tobby88 opened this issue Aug 1, 2019 · 23 comments
Closed

Shelly 2.5 - dual power metering #6160

tobby88 opened this issue Aug 1, 2019 · 23 comments
Labels
enhancement Type - Enhancement that will be worked on fixed Result - The work on the issue has ended

Comments

@tobby88
Copy link

tobby88 commented Aug 1, 2019

I stumbled upon this: https://shelly.cloud/shelly-25-wifi-smart-relay-roller-shutter-home-automation/

"DUAL POWER METERING
Shelly 2.5 has two integrated precise power meters. You can measure the consumption for each channel separately."

With Tasmota it only shows one power metering (which seems to be a sum of both outputs?).

It would be nice if Tasmota supports both measurings seperately.

@ascillato2 ascillato2 added the enhancement Type - Enhancement that will be worked on label Aug 2, 2019
@arendst arendst self-assigned this Sep 11, 2019
@arendst
Copy link
Owner

arendst commented Sep 14, 2019

How about this:

image

16:24:49 MQT: tele/shelly25/SENSOR = {"Time":"2019-09-14T16:24:49","Switch1":"OFF","Switch2":"OFF","ANALOG":{"Temperature":52.5},"ENERGY":{"TotalStartTime":"2019-04-13T18:21:03","Total":3.262,"Yesterday":0.000,"Today":0.005,"Period":1.34,"Power":[23.63,67.17],"ApparentPower":[23.63,67.17],"ReactivePower":[0.00,0.00],"Factor":[1.00,1.00],"Voltage":229.3,"Current":[0.103,0.293]},"TempUnit":"C"}

@ghost
Copy link

ghost commented Sep 14, 2019

Very nice, thanks!

Is it possible to get the energy totals per channel as well or does the device only track the combined total?
Sry, already flashed Tasmota on mine so I can't check the original Shelly software anymore.

arendst added a commit that referenced this issue Sep 15, 2019
 * Change energy sensors for three phase/channel support
 * Add Shelly 2.5 energy dual channel support (#6160)
@arendst
Copy link
Owner

arendst commented Sep 15, 2019

For now with consolidated Energy totals.

@digiblur
Copy link
Contributor

Nice! Looking forward to it with the Shelly EM as well (same power chip)

@arendst
Copy link
Owner

arendst commented Sep 16, 2019

Did you try Shelly EM with template of Shelly 2.5?

{"NAME":"Shelly 2.5","GPIO":[56,255,17,255,21,83,0,0,6,82,5,22,156],"FLAG":2,"BASE":18}

@digiblur
Copy link
Contributor

I haven't yet but definitely bumping it up in my list for this week to test.

@meingraham
Copy link
Collaborator

@arendst

How does Domoticz handle JSON "arrays"? In this SENSOR message,

{"Time":"2019-09-14T16:24:49","Switch1":"OFF","Switch2":"OFF","ANALOG":{"Temperature":52.5},"ENERGY":{"TotalStartTime":"2019-04-13T18:21:03","Total":3.262,"Yesterday":0.000,"Today":0.005,"Period":1.34,"Power":[23.63,67.17],"ApparentPower":[23.63,67.17],"ReactivePower":[0.00,0.00],"Factor":[1.00,1.00],"Voltage":229.3,"Current":[0.103,0.293]},"TempUnit":"C"}

I'm having trouble setting up a JSON function to return a separate value for each channel of any particular metric. For example, "Power":[23.63,67.17], I want to define an Item to extract Power1 and another to extract Power2. Right now the only thing I can return directly is [23.63,67.17] which I then have to parse and convert to extract each value.

I grasp how I would do it if it were formatted like
"Power":{"Channel1":23.63 ,"Channel2":67.17} but [23.63,67.17] now requires my own logic in my hub (openHAB) to process.

Your insights much appreciated ;-)

Mike

@arendst
Copy link
Owner

arendst commented Sep 16, 2019

  • Domoticz default returns only phase/channel 1 info using the inbuilt Domoticz parameters.
  • As an alternative a rule could be used to send the info to Domoticz.

I haven't tested rules using a JSON list but if it doesn't work I/someone have/has to find a solution.

@meingraham
Copy link
Collaborator

@digiblur

When you get around to testing this, can you see if HA can extract the individual values from the JSON payload?

Otherwise, @arendst, might I suggest this "Power":{"Channel1":23.63 ,"Channel2":67.17} or this "Power":{"Power1":23.63 ,"Power2":67.17} rather than this "Power":[23.63,67.17]? This way, I think most JSON functions can grab each value using an expression such as $.ENERGY.Power.Power1 or $.StatusSNS.ENERGY.Power.Power1 (e.g., from a STATUS8/STATUS10 payload).

Mike

@arendst
Copy link
Owner

arendst commented Sep 16, 2019

Nice suggestion but it takes too much space. When three phase devices are used it needs three value pairs for each power, voltage and current item. This makes the JSON string too long for both MQTT response and rule/script handling.

JSON lists are handled succesfully in other tools so I guess we have to find a way to make it work with rules too.

@meingraham
Copy link
Collaborator

meingraham commented Sep 16, 2019

Time for the Rules/Scripting caped crusaders (@ascillato @laurentdong @gemu2015) to come to the rescue 😉

@effelle
Copy link
Contributor

effelle commented Sep 16, 2019

Quick test with value_json under Home Assistant show me is possible to split the value using an index. Not sure if I can do the same on OH Jsonpath.

{% set value_json = {"Time":"2019-09-14T16:24:49","Switch1":"OFF","Switch2":"OFF",
"ANALOG":{"Temperature":52.5},"ENERGY":{"TotalStartTime":"2019-04-13T18:21:03",
"Total":3.262,"Yesterday":0.000,"Today":0.005,"Period":1.34,"Power":[23.63,67.17],
"ApparentPower":[23.63,67.17],"ReactivePower":[0.00,0.00],"Factor":[1.00,1.00],
"Voltage":229.3,"Current":[0.103,0.293]},"TempUnit":"C"} %}

{{ value_json.ENERGY.Current[0] }} = 0.103
{{ value_json.ENERGY.Current[1] }} = 0.293

No idea how to filter the values with rules.

@effelle
Copy link
Contributor

effelle commented Sep 16, 2019

Jsonpath can use index too.
$.ENERGY.Current[0] = 0.103
$.ENERGY.Current[1] = 0.293

@gemu2015
Copy link
Contributor

should already work in scripter e.g.

var=ENERGY#Power[1]

@effelle
Copy link
Contributor

effelle commented Sep 16, 2019

So what we miss is handling with normal rules?

@arendst
Copy link
Owner

arendst commented Sep 16, 2019

So cut (scripter) and paste (rule) should solve it.

@meingraham
Copy link
Collaborator

Yeah, stupid me used [1] and [2]. I thought it was unsupported syntax in OH when it was PEBCAK!

@tobby88
Copy link
Author

tobby88 commented Sep 18, 2019

How about this:

image

16:24:49 MQT: tele/shelly25/SENSOR = {"Time":"2019-09-14T16:24:49","Switch1":"OFF","Switch2":"OFF","ANALOG":{"Temperature":52.5},"ENERGY":{"TotalStartTime":"2019-04-13T18:21:03","Total":3.262,"Yesterday":0.000,"Today":0.005,"Period":1.34,"Power":[23.63,67.17],"ApparentPower":[23.63,67.17],"ReactivePower":[0.00,0.00],"Factor":[1.00,1.00],"Voltage":229.3,"Current":[0.103,0.293]},"TempUnit":"C"}

Looks nice :) Small improvement: I would suggest to add the unit in the UI after every value, not just at the end, but maybe that's a matter of taste.

To seperate the energy as suggested by @KaiserSoft would be very nice to :)

arendst added a commit that referenced this issue Sep 22, 2019
Add JSON array index support to rules evaluation allowing trigger on ENERGY#POWER[2]>0.60 from JSON ..,"Power":[0.00,0.68],.. (#6160)
@arendst arendst removed their assignment Oct 2, 2019
@arendst arendst added the fixed Result - The work on the issue has ended label Oct 2, 2019
@ascillato2
Copy link
Collaborator

Closing this issue as the feature has been added. Thanks :)

@cmiguelcabral
Copy link
Contributor

cmiguelcabral commented Mar 6, 2020

I know this issue is already closed, but I'm looking for a similar thing that is having Totals also split.
Home Assistant's Utility Meter uses the total energy, giving that, I'm unable to know how much energy each machine (connected to a different output) is consuming.
Any plan to add that??
Thanks

@umairyounus
Copy link

Any way we can get a split total?

@Y-V-L
Copy link

Y-V-L commented Aug 28, 2021

What about the Split of the Totals. This is also needed for the Shelly EM and Shelly EM3 if you will be able to count the imports and exports separately ...

@ascillato
Copy link
Contributor

Splitted totals added to Tasmota by Theo.

d3fc03d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Type - Enhancement that will be worked on fixed Result - The work on the issue has ended
Projects
None yet
Development

No branches or pull requests