The current in the energy.current.js file is typed as DEVICE_FEATURE_TYPES.SWITCH.ENERGY instead of DEVICE_FEATURE_TYPES.SWITCH.CURRENT and same for voltage, /1000 when it shouldn’t be (in the example above the pump consumes 740W, i.e. 3.5A),
I’m preparing a PR, but I want to be sure I don’t break anything, especially for voltage and current. Could you confirm whether you couldn’t check the results, or if it was done with other hardware that sent them in that order? Because in the second case we need to allow choosing the scaling…
As long as we’re sure that only the POW-R2 returns the original energy values. I haven’t found any others from Sonoff. But via Tasmota with the format \"ENERGY\":{}, I think it’s the only one.
Message | Unit | Description
---------------|------|-----------------------------------------------------
TotalStartTime | Date | DateTime of calculation for Total
Total | kWh | Total Energy usage including Today
Yesterday | kWh | Total Energy usage between 00:00 and 24:00 yesterday
Today | kWh | Total Energy usage today from 00:00 until now
Period | Wh | Energy usage between previous message and now
Power | W | Current effective power load
ApparentPower | W | Power load on the cable = sqrt(Power^2 +
| | ReactivePower^2)
ReactivePower | W | Reactive load
Factor | | The ratio of the real power flowing to the load to
| | the apparent power in the circuit
Voltage | V | Current line voltage
Current | A | Current line current
By the way it returns W for apparent and reactive power, but if I’m not mistaken it should be VA normally. (ok I’m nitpicking)
There is an energy sensor type with all the appropriate units.
Indeed that’s exactly what I used. But my question is mainly about other devices that can send this energy information. I don’t know of any others that natively provide this information. For the POW-R2 (unlike the DHT11 or others), it does not send its model in the MQTT message. So, if other devices send this data, how can we be sure not to break those files which cannot be anything other than global. In the tests, I see that @AlexTrovato put values divided by 1000 (0.120 for the voltage, for example), but that leaves two possible reasons for this:
Did he have another device model that returned that?
No no you’re not nitpicking ^^ That’s right and it’s « important » to distinguish for an electrician ^^, but I think the docs aren’t correct because on the interface we do see VA and VAr :
So, we agree that dividing by 1000 shouldn’t happen; in that case the user will just have to change the unit to millivolts which is available in the editor?
Totally, it would have been better to return the module model as is done with the DHT11 for example, to disambiguate in cases like this.
Do you think I can open the PR (pull request) like this?
Indeed!! We can rather move these Tasmota features into « Energy », indeed. They are quite specific and categorized as « Energy » on tasmota. The switch itself is indeed separate!!^^
I need testers for a fix made to the Tasmota integration related to PR #1526, notably for Sonoff POW R2. It doesn’t matter whether you have a Sonoff POW R2 or not; the goal is to test that it doesn’t break the current functionality. Even better if you have other Tasmota devices using the features specified below (although I don’t see any reason why anything would break with this change).
As a reminder, the changes are as follows:
Fix of an error on the intensity feature which was translated as energy.
Fix of the voltage which was divided by 1000 resulting in mV for the POW R2 (with unit in Volt). If on other devices the voltage is reported in millivolts then the user will have to select the correct unit in the device edit menu.
Fix of the category and type of the energy feature to ENERGY_SENSOR rather than SWITCH in order to obtain the correct units in the device/function edit menu.
Added the following energy data (notably for the Sonoff POW-Rx model):
Apparent electrical consumption,
Reactive power consumption,
Total energy,
Energy consumed today.
Fix of the Volt-Ampere reactive unit on the frontend which, in the i18n files, was in lowercase (var instead of VAr)
Fix of the Watt and kiloWatt units on the frontend which were not mentioned in the fr.json file (« Watt » instead of « Watt (W) » and « KiloWatt » instead of « KiloWatt (kW) ») but were correct in the en.json file.
You can test either via the PR, or via the Docker image currently being built: docker pull terdious/gladys:tasmota-POW-R2-features-fixes
On my side, everything I was able to test works as far as Tasmota is concerned.
MQTT discovery OK
HTTP discovery OK
Switches, temperatures, humidity OK
The rest of the instance seems to be working without issues.
Tested on Raspberry Pi 2 (RPi2) Bullseye official 32-bit lite with the following installation command :
PS: While you’re at it, do you think you could do something so that the integration supports RF, IR, or even RFID (RC522)?
I know there was an issue because the codes are returned in hexadecimal, but I see that they can be made to be in decimal by typing two commands in the device console: See here
To be sure this doesn’t break anything on an existing installation, do you think you could stop the instance, copy/paste your production DB onto it and restart? And verify that everything works correctly on your existing Tasmota devices?
Thanks in advance if you can ^^
So for that part, I can still take a look, but I’m not sure I’m experienced enough to figure it out.
On my side I have 4 Sonoff RF 433 modules for my motion detectors. Currently I operate via a programmed MQTT publish within the Tasmota devices. But indeed I’d be interested in having the functionality directly; I’ll look into it but it won’t be in the same PR.
Do you have any example hardware references for the other two (IR and RFID)?
If you have a POW Rx, I’m even more interested so I can be sure it works on another instance ^^ Bon after I tested with my 3 DBs so there should normally be no problem ^^
By the way that makes me think, @GBoulvin and @VonOx , don’t you happen to have a Tasmota that uses those features by any chance (voltage, power, energy).
There you go, it’s tested: substitution of the production DB into Gladys’s test version.
No anomalies noticed in the Tasmota, MQTT, cameras, OpenWeather integration or on the dashboard.
I didn’t test the conversation (forgot)…
Have a good Sunday!
Edit: I tested the conversation (room temperature request): OK
And for info