-
Notifications
You must be signed in to change notification settings - Fork 26
Inspelning negative power values? #109
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
Comments
Hey, code-wise negative values are not a problem. Sadly I couldn't get my hands on the inspelning yet so I don't know if they work with negative values. |
It seems that they were solving similar issues here, the solution seems to be in the appended zip file in the state_power_division_item, but I can't test it. |
Well, I now started to use the dirigera HACS integration, which is based on this code. So, I know, that there are 7 sensor entities read from Dirigera for the Inspelning plug: current_active_power (W) The last two i ignore. But when I tried to measure my PV input, there were no values for (W), but for (kWh). So I currenty get stuck with my powerline connected measuring plug. However, this is old and there is no replacement, when in will be broken somewhen. |
I've heard some devices were faulty. If your device isn’t giving the correct total energy readings, one workaround is to compute the instantaneous active power using following formula—provided you have an accurate value for the power factor. Once you have the instantaneous power, you can integrate it over time to get the energy consumed. If your load is purely resistive, cos(phi) is 1, and the formula simplifies to P = U * I. For reactive loads (inductive or capacitive), cos(phi) will be less than 1. For example, if you’re sampling every Delta t seconds, the energy in watt‑hours (Wh) over that period is approximately: U is current_voltage in your data This integration converts the power (in watts) into energy (in watt‑hours) by accounting for the time factor (since 1 hour = 3600 seconds). |
Here's an example python code (generated by AI, can't test it as I don't have the device) to give you the idea: import math
def calculate_active_power(current_voltage, current_amps, |
Some of my Tasmota plugs had to be calibrated using a good old 60W resistive bulb. Others, like those from Athom, were pretty fine precalibrated. I don‘t know, if the Inspelning plugs need calibration. |
Yeah, as you're saying, it should result the same value as shown in current_active_power (W). From what youre mentioning, I'd start with the asumption that your house grid resembles a resistive load environment, and set power factor cos(phi) to 1. Here's the simple way how to integrate your own Python script into Home Assistant: https://www.home-assistant.io/integrations/python_script/ Plus you can always ask in https://github.com/home-assistant/core/issues PS: another unrelated idea that can hypothetically help - I'd check if the firmware for Inspelning is the latest. Although I dunno how to force update devices in the new Ikea Smart app (it was possible in the old one), it's atleast possible to check if the firmware is the latest in the device info (device info is hidden in the wrench icon on the top right when selecting the device). |
My first simple approach was, to create a helper group to calculate the product of two sensors. That works, although i could not add a unit of measurement at the UI. Well, it looks obvious, that the calculation differs to that of the sensor, just when use the Inspelning plug in a regular output manner: Calculated from the helper: It looks obvious, that the watts from the sensor are pretty different to the calculated product V*A. So, now I am somewhat confused. |
It's probably not reflecting the sensor's measured active power because it ignores the power factor. It could be that the load is highly reactive, and only about 36,5 % of the apparent power. cos(phi)= P / V*I = 4.2 / 11.5 ~= 0.365 I'd try another calculations with the power factor. (And of course there's always chance that the device is faulty, but let's not assume that yet) |
I am going to perform my calibration routine, which I did for all of my tasmota plugs: |
Just to present the result of my plan: But I do not have any connection to Ikea, to offer these suggestions. |
Here's another idea: It is possible to download APK version of Ikea's Home Smart app from: https://www.apkmirror.com/apk/inter-ikea-systems-b-v/ikea-home-smart/ Then it's possible to unpack it, then because the code will be obfuscated, it would have to be deobfuscated, and after that it would be possible to check what formula directly IKEA uses. But it's very tedious work. Communication wise - the Inspelning sensor only sends data that you've seen in this repository. |
For me it is beyond of my skills even to write python code. I can hardly read it and understand only parts of it. So, deobfuscation will be a no go. |
I was intended to use an Inspelning plug for power measurement at a mini PV panel. Although amps are displayed, there are no values for power (watts). Does this python setup not support negative values or is the plug not suitable for this job? I am wondering, as i have some shelly and tasmota plugs, which could easily display values, no matter, in which direction the power goes. However, at the panel location, there is not and will not be wifi available, but Zigbee is there. So, Inspelning would be the device of choice, if the data could be extracted properly.
The text was updated successfully, but these errors were encountered: