[PLUGIN] Tasmota Power Monitor


Recommended Posts

Hi guys,

 

I want to introduce you to my Tasmota Power Monitor.

 

With this UnRaid plugin you can turn a Tasmota device into an energy monitor for your server.

I got the idea from corsairpsu-unraid, but since I don't have a suitable Corsair PSU, I found an alternative in a Tasmota Power Plug.

 

It shows the most common measured values and offers the option of costing for electricity consumption.

 

Dashboard:

grafik.png.c93a5b683b5f81032d83b20382f26aac.png

 

Settings:

grafik.png.a3170d5d1f22a5012fa7d8781cbb7ee2.png

The password is saved in plain text.

 

Introduction

Before you start, be sure that you protect your Tasmota device against incorrect operation. So that you don't accidentally turn off your server. I solved this for myself with the command: PowerOnState 4 This sets the on / off switch in the WebUI and on the device to always on. Therefore, check what would be best for your device before using it. Have a look at the Tasmota Documentation. Use the plugin and device at your own risk. I will not be responsible for any damage.

 

I use an Aisirer Power Monitoring Plug (AWP07L) with Tasmota firmware 8.5.1 and this template. {"NAME":"AWP07L","GPIO":[56,255,255,255,255,134,255,255,131,17,132,21,255],"FLAG":0,"BASE":18}

 

 

Created and tested with Unraid 6.9.1.

 

Installation as usual...

https://raw.githubusercontent.com/Flippo24/tasmotapm-unraid/main/tasmotapm.plg

  • Like 8
Link to comment

By checking around which smart plug fit this project, this is quite hard to confirm or buy a suitable hardware.

Seems Sonoff POW R2 is right thing to do that, ESP32 solution with unknow power metering chips ( suppose same chips / driving method as your smartplug ), so I have buy one for try.

 

Do you identify the efficiency reading quite low, does all reading come from Smartplug, none of that generate by plugin ? ( or it should be 94% instead 0.94% )

 

Thanks your Plugin !!!

 

Below are the video about flash POW-R2 with Tasmota firmware

 

Edited by Vr2Io
Link to comment
11 minutes ago, mrbilky said:

This should work sonoff s31 I have a half dozen flashed with Tasmota and integrated into home assistant

Does s31 have power metering feature ( circuity ) ?  It have, seems it is US version. So good.

 

image.thumb.png.630cc2dc15a293cd16271b66d318f13d.png

Edited by Vr2Io
Link to comment

Take a look at Tasmota Device Templates Repository. There you will find many devices that have a measurement option. Which exactly one owns cannot not say. Often, however, there is a power monitoring plug in the title. If you go to a device there is often something like "For more accurate energy consumption measurements this device requires power monitoring calibration". And in the GPIO table there are more entries than relay, button and LED. Compare it to other devices. Maybe that will help you with the selection.

 

The plugin only reads the values from the device. It sounds as simple as that. It shows the data that are called in the WebUI console with the Status 8 command. Only the price calculation takes place in the plugin. So power * price.

 

Nice Vr2lo you found the first bug. Of course you are right. It has to be 94%. This is shown as a factor in the WebUI. Will correct it. Maybe there will be some more. Then it's worth it.

 

  • Like 1
Link to comment
29 minutes ago, ich777 said:

@Flippo Thank you for the great Plugin!

Would it be eventually possible to integrate espurna: Github?

 

He also has a neat little RESTAPI that you can get data from: Click

Can you open a separate topic for it and post the url with all parameters for your request and a json with the answer. Then we can discuss it there. I think that it would be better off in a separate plugin. The structure would be almost identical.

Link to comment

Just a feedback, Sonoff POW R2 work great. I short the relay output, so won't power off out of expectation, then set "SetOption21" to 1 (Energy monitoring when power is off) to save unnecessary power usage from relay.

 

Thanks this plugin.

 

image.png.64aea41e12c65d488a29d9ebb2335c34.png

 

Screen shoot of communication / flash firmware under Unraid, install 3 component

 

image.png.a2acc21207bdd3082ad40c84ba34af67.png

 

image.thumb.png.2c5d05bf5e30ea67b60efe679eaabf10.png

Edited by Vr2Io
Link to comment
  • 2 weeks later...

This plugin breaks the layout.

 

I can't arrange the dashboard widget, the sort order randomly changes.

The widget is sometimes shown twice, but the corsair widget disappears.

 

Did you change the html classes while adapting from the Corsair PSU Plugin, because i use this also.

 

tnxs greetz Stefan

 

 

grafik.thumb.png.c501451133903087a2626f96aef317ac.png

Edited by corgan
Link to comment
  • 1 month later...
On 4/13/2021 at 5:06 AM, corgan said:

This plugin breaks the layout.

 

I can't arrange the dashboard widget, the sort order randomly changes.

The widget is sometimes shown twice, but the corsair widget disappears.

 

Did you change the html classes while adapting from the Corsair PSU Plugin, because i use this also.

 

tnxs greetz Stefan

 

 

grafik.thumb.png.c501451133903087a2626f96aef317ac.png

 

Hi Stefan,

maybe a bit late, sorry. I need to change the code a bit. Previously, I had the same problem with multiple ads when moving. Take a look at the use of @sortnr.

status.page

This was previously a fixed number. Now it is dynamic. I had a really hard time with this error. The table header has now been moved to the table body. It doesn't make sense, but otherwise I couldn't get it to work.

 

  • Like 1
Link to comment
  • 2 months later...

Can this plugin be searchable from Community applications?

I have a cheap tuya plug (BSD33), ripped the plug apart, flashed tasmota, calibrated power metering, and conected with the plugin. Works fine, although I would like to read the power consumpltion with MQTT and not http.

Link to comment
2 hours ago, Maor said:

read the power consumpltion with MQTT and not http.

Tasmota support MQTT and Http in parallel run.

 

I apply power off if power usage larger then xx watts ( actually won't power off due to I already short the reply switch ), then as result LED will on if power usage larger then xx watts and off once less.

 

20:22:40.842 MQT: stat/tasmota_B88B5C/WARNING = {"Time":"2021-08-29T20:22:40","MaxPowerReached":90}
20:22:40.856 MQT: stat/tasmota_B88B5C/RESULT = {"POWER":"OFF"}
20:22:40.861 MQT: stat/tasmota_B88B5C/POWER = OFF
20:22:46.876 MQT: stat/tasmota_B88B5C/WARNING = {"Time":"2021-08-29T20:22:46","MaxPowerReached":91}
20:22:46.890 MQT: stat/tasmota_B88B5C/RESULT = {"POWER":"OFF"}
20:22:46.895 MQT: stat/tasmota_B88B5C/POWER = OFF
20:22:52.842 MQT: stat/tasmota_B88B5C/WARNING = {"Time":"2021-08-29T20:22:52","MaxPowerReached":90}
20:22:52.858 MQT: stat/tasmota_B88B5C/RESULT = {"POWER":"OFF"}
20:22:52.863 MQT: stat/tasmota_B88B5C/POWER = OFF

 

Edited by Vr2Io
  • Like 1
Link to comment
  • 5 months later...
On 4/14/2021 at 12:07 PM, kevinshane said:

awesome job, could you please support multiple sonoff pow?

 

Late reply. Same Problem. I edit /usr/local/emhttp/plugins/tasmotapm/status.php and add the number of channel to the array, looks like this:

$json = array(
                'Total' => $data['StatusSNS']['ENERGY']['Total']['0'],
                'Today' => $data['StatusSNS']['ENERGY']['Today']['0'],
                'Yesterday' => $data['StatusSNS']['ENERGY']['Yesterday']['0'],
                'Voltage' => $data['StatusSNS']['ENERGY']['Voltage'],
                'Current' => $data['StatusSNS']['ENERGY']['Current']['0'],
                'ApparentPower' => $data['StatusSNS']['ENERGY']['ApparentPower']['0'],
                'ReactivePower' => $data['StatusSNS']['ENERGY']['ReactivePower']['0'],
                'Factor' => $data['StatusSNS']['ENERGY']['Factor']['0'],
                'Power' => $data['StatusSNS']['ENERGY']['Power']['0'],
                'Costs_Price' => $tasmotapm_costs_price,
                'Costs_Unit' => $tasmotapm_costs_unit
        );

 

On http://IP_OF_YOUR_DEVICE/cm?cmnd=Status%208 you seen the number of the channel you need.

 

 

 

2022-02-15 22_57_27-PALLAS_Dashboard.png

Edited by HrzM
Link to comment
  • 2 months later...
  • 5 months later...
  • 1 month later...
  • 3 weeks later...
On 12/27/2022 at 7:18 PM, Twix said:

Does this plugin still work?
I use a tasmota device with 12.3.0 and I have no values at all on the dashboard. They are just empty.

12.3.1.2 no problem.

 

You can enable web debug logging and check the error in web console

 

20:51:01.642 HTP: Command
20:51:01.651 SRC: WebCommand from 0.0.0.0
20:51:01.653 HTP: Bad userid and/or password

 

20:54:41.001 HTP: Command
20:54:41.006 SRC: WebCommand from 192.168.X.X
20:54:41.009 CMD: Grp 0, Cmd 'STATUS', Idx 1, Len 1, Pld 8, Data '8'

 

Edited by Vr2Io
Link to comment
  • 1 month later...

I am having problems with this plugin and my flashed to latest Tasmota (12.4.0) Shelly Plug S.

When the script is activated the Shelly will reconnect from time to time (flashing LED for WLAN) + lose power for 0.5 seconds.

The idea was to use the plug for monitoring only my Unraid server. With all the reconnects it will be a nightmare..

When disabling the script everything is fine and there are no disconnects.

Any ideas?

Link to comment
  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.