Add shelly em 1 gen
Sorry, third try. Git, pr and branches are relatively new to me. I have now removed the superfluous comments and hasUpdate
The Shelly EM has two measurement channels, but only on one phase.
The Gen1 also didn't provide amperage via the API, so the existing implementations can't be used.
This PR gives the user the ability to select the measured phase (SinglePhaseMeter) and also the option to sum the two channels.
Codecov Report
:x: Patch coverage is 80.25478% with 31 lines in your changes missing coverage. Please review.
Additional details and impacted files
@@ Coverage Diff @@
## develop #3129 +/- ##
=============================================
+ Coverage 58.52% 58.58% +0.06%
Complexity 173 173
=============================================
Files 2590 2592 +2
Lines 111461 111618 +157
Branches 8206 8225 +19
=============================================
+ Hits 65226 65380 +154
+ Misses 43818 43804 -14
- Partials 2417 2434 +17
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Please also add tests so we can see the raw Data we get from your device (sometimes it differs from old docs) also it is a good way to get familiar with OpenEMS test system :)
I've re-added the hasUpdate. The Gen1 devices report this too. See also here.
I've re-added the
hasUpdate. The Gen1 devices report this too. See also here.
As i told you it would be great if you could just open the link in a Browser e.g.: 192.168.178.144/status and post the ACTUAL json which your device outputs and create a Test for the New Shelly aswell.
Of course, this is the output of my device:
{
"wifi_sta": {
"connected": true,
"ssid": "",
"ip": "172.20.30.30",
"rssi": -30
},
"cloud": {
"enabled": false,
"connected": false
},
"mqtt": {
"connected": false
},
"time": "20:16",
"unixtime": 1747505765,
"serial": 6294,
"has_update": false,
"mac": "",
"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": "input"
}
],
"emeters": [
{
"power": 4.11,
"reactive": 0,
"pf": -0.07,
"voltage": 219.97,
"is_valid": true,
"total": 3301893.8,
"total_returned": 785.7
},
{
"power": 5.04,
"reactive": -12.38,
"pf": -0.38,
"voltage": 219.97,
"is_valid": true,
"total": 683493.3,
"total_returned": 194.1
}
],
"update": {
"status": "idle",
"has_update": false,
"new_version": "20230913-114150/v1.14.0-gcb84623",
"old_version": "20230913-114150/v1.14.0-gcb84623",
"beta_version": "20231107-164916/v1.14.1-rc1-g0617c15"
},
"ram_total": 51064,
"ram_free": 33076,
"fs_size": 233681,
"fs_free": 150349,
"uptime": 281011
}
Of course, this is the output of my device:
{ "wifi_sta": { "connected": true, "ssid": "", "ip": "172.20.30.30", "rssi": -30 }, "cloud": { "enabled": false, "connected": false }, "mqtt": { "connected": false }, "time": "20:16", "unixtime": 1747505765, "serial": 6294, "has_update": false, "mac": "", "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": "input" } ], "emeters": [ { "power": 4.11, "reactive": 0, "pf": -0.07, "voltage": 219.97, "is_valid": true, "total": 3301893.8, "total_returned": 785.7 }, { "power": 5.04, "reactive": -12.38, "pf": -0.38, "voltage": 219.97, "is_valid": true, "total": 683493.3, "total_returned": 194.1 } ], "update": { "status": "idle", "has_update": false, "new_version": "20230913-114150/v1.14.0-gcb84623", "old_version": "20230913-114150/v1.14.0-gcb84623", "beta_version": "20231107-164916/v1.14.1-rc1-g0617c15" }, "ram_total": 51064, "ram_free": 33076, "fs_size": 233681, "fs_free": 150349, "uptime": 281011 }
thanks for the info - would you mind creating a test aswell please?
I'm sorry if this sounds silly, but what exactly do you mean?
The test is already included in this PR, but only with a shorter version of the JSON.
Should I expand it?
I'm sorry if this sounds silly, but what exactly do you mean?
The test is already included in this PR, but only with a shorter version of the JSON.
Should I expand it?
Sorry, did not recognize you already had it ready :P from my side it looks good now ! :)
@sfeilmeier i guess ready for merge? :)
Hi @sfeilmeier,
i've fixed the JUnit test and added the information to readme.adoc.
Hi @sfeilmeier,
i've fixed the JUnit test and added the information to
readme.adoc.
Looks like the test is still failing
You are right. The problem was the api call. I implemented the same method as it used in the Shelly 3EM: https://github.com/OpenEMS/openems/blob/bd3f81c133ea1b64cbf9097bdb00b2b0e6024e1b/io.openems.edge.io.shelly/src/io/openems/edge/io/shelly/shelly3em/IoShelly3EmImpl.java#L128
https://github.com/OpenEMS/openems/blob/bd3f81c133ea1b64cbf9097bdb00b2b0e6024e1b/io.openems.edge.io.shelly/src/io/openems/edge/io/shelly/common/Utils.java#L77
But in my point of view, this is a bug in the implementation of the shelly 3EM. The gen 1 devices are not supporting the RPC Protocol. But the shelly 3EM is gen 1 device.
You are right. The problem was the api call. I implemented the same method as it used in the Shelly 3EM: https://github.com/OpenEMS/openems/blob/bd3f81c133ea1b64cbf9097bdb00b2b0e6024e1b/io.openems.edge.io.shelly/src/io/openems/edge/io/shelly/shelly3em/IoShelly3EmImpl.java#L128
https://github.com/OpenEMS/openems/blob/bd3f81c133ea1b64cbf9097bdb00b2b0e6024e1b/io.openems.edge.io.shelly/src/io/openems/edge/io/shelly/common/Utils.java#L77
But in my point of view, this is a bug in the implementation of the shelly 3EM. The gen 1 devices are not supporting the RPC Protocol. But the shelly 3EM is gen 1 device.
I had the Shelly Pro 3EM in my site and tested it in real Life Szenario - so this is not true - also it is running live on a friend of mines Instance.
Okay, this is strange.
I didn't have one to test it with, but RPC isn't listed in the official documentation.
It is not working with the Shelly EM.
Okay, this is strange.
I didn't have one to test it with, but RPC isn't listed in the official documentation.
It is not working with the Shelly EM.
You are right ! As i wrote i looked under Shelly 3 Pro EM - maybe you could change this in the 3EM Gen 1 aswell?
I can change it, but it should be mentioned, that i'm not able to test this.
Also i would to this in an seperate PR.
@sfeilmeier Is there anything missing for the merge?
@deadrabbit87 Yes... time. Sorry, I'll try to work on it as soon as I find time.
This PR has been automatically marked as stale due to inactivity. It will be closed in 7 days if no further activity occurs.