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

Add support for Shelly EM (2 channels) meter #4244

Closed
efrencd opened this issue Aug 27, 2022 · 19 comments · Fixed by #4273
Closed

Add support for Shelly EM (2 channels) meter #4244

efrencd opened this issue Aug 27, 2022 · 19 comments · Fixed by #4273
Labels
devices Specific device support

Comments

@efrencd
Copy link

efrencd commented Aug 27, 2022

Currently EVCC has a template for Shelly 3EM (3 channel Shelly Meter).

Theres is also a 2 channel cheaper model which is not included as a template in EVCC.

Product description in Shelly website.
https://shelly.cloud/products/shelly-em-smart-home-automation-device/

It would be nice to add support for it.

Thanks!

@andig andig added the devices Specific device support label Aug 27, 2022
@andig
Copy link
Member

andig commented Aug 27, 2022

/cc @thierolm

@VolkerK62
Copy link
Contributor

@efrencd I use this also. You know, that you can use the http-plugin for integration?

@efrencd
Copy link
Author

efrencd commented Aug 27, 2022

I didn't know. I'll try.

Anyway a direct integration with a template would be welcomed.

Thanks!

@thierolm
Copy link
Contributor

thierolm commented Aug 30, 2022

Hi @efrencd ,
have U tested the shelly charger or shelly-pm1 meter template?
U are able to define the channel in order to select P1 (channel = 0) or P2 (channel = 1) switch+meter ...

@VolkerK62
Copy link
Contributor

Hi @thierolm ,
I have Shelly EM in use.
I tried shelly-1pm template. It doesn´t work.

- name: WP_power # Verbrauch (charger) Wärmepumpe
  type: template
  template: shelly-1pm
  host: 192.168.178.21
  channel: 1

result evcc meter

WP_power
--------
Power: invalid channel, missing power meter

@VolkerK62
Copy link
Contributor

So funktioniert es (custom)

- name: WP_power # Verbrauch (charger) Wärmepumpe
  type: custom
  power:         # Shelly EM Stromzange 2
    source: http
    uri: http://192.168.178.21/emeter/1
    jq: .power  

@thierolm
Copy link
Contributor

Hi @VolkerK62 , could U pls provide me a trace log: evcc meter -l trace

@VolkerK62
Copy link
Contributor

VolkerK62 commented Aug 31, 2022

@thierolm
Here the template version:

pi@raspberrypi:~ $ evcc meter -l trace
[main  ] INFO 2022/08/31 09:16:30 evcc 0.100 (98d9a938)
[main  ] INFO 2022/08/31 09:16:30 using config file /etc/evcc.yaml
[shelly] TRACE 2022/08/31 09:16:31 GET http://192.168.178.21/shelly
[shelly] TRACE 2022/08/31 09:16:31 {"type":"SHEM","mac":"C45BBE77DE81","auth":false,"fw":"20220809-125130/v1.12-g99f7e0b","discoverable":true,"longid":1,"num_outputs":1,"num_meters":0,"num_emeters":2,"report_period":1}
WP_power
--------
[shelly] TRACE 2022/08/31 09:16:31 GET http://192.168.178.21/status
[shelly] TRACE 2022/08/31 09:16:31 {"wifi_sta":{"connected":true,"ssid":"KAS1","ip":"192.168.178.21","rssi":-52},"cloud":{"enabled":false,"connected":false},"mqtt":{"connected":false},"time":"09:16","unixtime":1661930190,"serial":16567,"has_update":false,"mac":"C45BBE77DE81","cfg_changed_cnt":0,"actions_stats":{"skipped":0},"relays":[{"ison":false,"has_timer":false,"timer_started":0,"timer_duration":0,"timer_remaining":0,"overpower":false,"is_valid":true,"source":"http"}],"emeters":[{"power":29.72,"reactive":35.57,"pf":0.64,"voltage":231.89,"is_valid":true,"total":226709.4,"total_returned":312236.8},{"power":1.56,"reactive":0.00,"pf":0.00,"voltage":231.89,"is_valid":true,"total":101094.1,"total_returned":0.5}],"update":{"status":"idle","has_update":false,"new_version":"20220809-125130/v1.12-g99f7e0b","old_version":"20220809-125130/v1.12-g99f7e0b"},"ram_total":51072,"ram_free":35868,"fs_size":233681,"fs_free":156373,"uptime":235549}
Power: invalid channel, missing power meter

@VolkerK62
Copy link
Contributor

Ahh, meter vs emeter??
"num_meters":0,"num_emeters":2

@thierolm
Copy link
Contributor

Ahh, meter vs emeter?? "num_meters":0,"num_emeters":2

Jepp, da haben die Shelly Entwickler mal wieder nix von JSON Standardisierung gehalten ... :-(

@andig:
Ich schau mal, dass ich am WE einen entsprechenden Erweiterungs-PR aufmache.

@thierolm
Copy link
Contributor

@VolkerK62 + @efrencd
Could U pls check test the PR? I do not have an Shelly EM device ...

@VolkerK62
Copy link
Contributor

Sorry, da hab ich absolut keine Ahnung, wie ich das machen könnte .... das hatten wir vor einiger Zeit schon mal ;-)
Wenn andig es ins nightly nimmt, kann ich es gleich morgen früh testen.

@andig
Copy link
Member

andig commented Sep 2, 2022

Ist drin

@VolkerK62
Copy link
Contributor

werd ich morgen mal testen.
Aber vorher noch ne blöde Frage: nehm ich das Shelly-1pm Template oder hat es ein eigenes bekommen?

@thierolm
Copy link
Contributor

thierolm commented Sep 2, 2022

nimm das Shelly-1pm template

@VolkerK62
Copy link
Contributor

@thierolm
ist usage: pv optional oder zwingend?
Ich nutze den Shelly EM als battery und als charge meter.
Aktuell als custom ohne usage.

@thierolm
Copy link
Contributor

thierolm commented Sep 2, 2022

Im Meter Template ist pv aktuell die einzige Option und muss so gesetzt werden. Du müsstest das so definierte Meter aber auch als battery meter in der evcc.yaml definieren können.
Wenn du den Shelly als Charger nutzen willst, musst du das shelly Charger Template nehmen.

@VolkerK62
Copy link
Contributor

Top job.
Funktioniert prima.
Ich bin immer wieder erstaunt, was und wie schnell alles möglich ist ;-)

@thierolm
Copy link
Contributor

thierolm commented Sep 3, 2022

Thx fürs Testen! Schönes WE!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devices Specific device support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants