hmm, there is no pf in emeter json
can you try http://<device ip>/emeter/0
and see if this includes pf
hmm, there is no pf in emeter json
can you try http://<device ip>/emeter/0
and see if this includes pf
Hi,
sorry the provided link for 3.0.x isnât compatibly with 3.0.x.
==> /var/log/openhab/openhab.log <==
2021-06-06 17:27:23.006 [WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.shelly-3.1.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.shelly [269]
Unresolved requirement: Import-Package: javax.measure; version="[2.1.0,3.0.0)"
at org.eclipse.osgi.container.Module.start(Module.java:444) ~[org.eclipse.osgi-3.12.100.jar:?]
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[org.eclipse.osgi-3.12.100.jar:?]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [bundleFile:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.6.4
{"power":766.62,"reactive":481.66,"voltage":222.50,"is_valid":true,"total":169336.3,"total_returned":0.0}
Appears not?
hmm, thatâs the problem. If no pf is included in the JSON the channel doesnât get created
which firmware are you running?
please try again, I did a rebuild
make sure to delete 3.1.0-SNAPSHOT.jar and use instead 3.0.3-SNAPSHOT.har, fo safety run openhab-cli clean-cache after deleting the old jar
Thankâs. The Sensor works now, everything seems fine.
Do you have an EM or 3EM?
It is an EM.
Thanks for your Feedback. After setting the IOT IP of the OH server within the Shelly binding config, all ColoT stuff started to work again.
Appreciate your help.
Thanks Sebastian
As you reported yourself the EM doesnât return âpfâ as part of the status JSON
The 3EM includes this field
{"power":13.16,"pf":0.62,"current":0.09,"voltage":236.20,"is_valid":true,"total":57771.5,"total_returned":0.1}
and therefore the channel shows up.
OK. Thanks. Have logged a query with Shelly - hopefully they get back to me?
If PF is shown in the EM Web UI it must be computed in the JavaScript code. Please save the html and post it here then I couild check. I have a EM and 3EM here, but currently Iâm reworking by test bed.
This includes the value = static HTML. It seems that the devices computes the value, but doesnât make it available through the REST API
<div id=âemeter_0â>
<div class=âemeterâ>
<span class=âem_title em_ch_nameâ>UPS Load</span>
<span class=âem_powerâ>287.56</span>
<span class=âem_unitsâ> W</span>
<a href=âhttp://x.x.x.x9/emeter/0/em_data.csvâ><span class=âem_csvâ></span></a>
<span class=âem_titleâ>PF <span class=âem_pfâ>0.83</span></span>
</div>
</div>
PF shows 0.83, not some kind of calculation
Thank you.
This is the initial response from Shelly:
You canât access the Power Factor, because it is not transferred. By default when you have the voltage and the current, you can calculate it.
With status, we are transferring an active and reactive power as well with the voltage. In this way, you can make the calculation.
Here is a calculator for power factor - Power Factor Calculator - Power Triangle - Inch Calculator
I have asked for clarity on the current which does not appear to be availble. Hopefully this is something planned for future firmware?
I found the formula in the JS code and adapted to the binding
if (Math.abs(m.power) + Math.abs(m.reactive) > 1.5) {
pf = m.power / Math.sqrt(m.power * m.power + m.reactive * m.reactive);
}
Please check the updated DEV build for 3.1M5
Be ware: If power+reactive is < 1,5 youâll get NaN (UnDefType.UNDEF) for the channel
Thank you. Seems to track the Web Interface pretty closely.
I have put in a state description to limit display to 2 decimals (same as what is displayed by Web interface (does not affect this view and I wanted to show both at the same time)
Will let you know what I hear back from Shelly.
Really appreciate your help.
I added rounding to 2 digits, please try
That works. The state is now captures as 2 decimals but is still being âforcedâ to three by the default state description:
Response body
Download
{
"link": "http://localhost:8080/rest/items/ShellyEM_UPS_PowerFactor",
"state": "0.80",
"stateDescription": {
"pattern": "%.3f",
"readOnly": true,
"options": []
},
"editable": true,
"type": "Number",
"name": "ShellyEM_UPS_PowerFactor",
"label": "Shelly EM UPS Power Factor",
"category": "",
"tags": [
"Point"
],
"groupNames": []
}
ok, once again, now set to %.2f