Tuya LOCAL with energy monitoring and without tuya-convert

Sometimes a restart of HA followed by a re-add of the device helps. Give it a try.

Happens to me in some plugs often. Just unplug them and re-plug until they work again…

Has anyone successfully blocked Tuya devices in firewall(pfsense) and got the devices to work after that.
i tried the below and it stops working.

Ps…i do have a rule just after this to enable comms to the Home Assistant server.

1 Like

This is not correct, you are blocking all communication from that source including DHCP… so devices will not get local IP.
You have to block only communication to public IP’s and let it communicate to local LAN IP’s including router.
have a look, here I block also HA because it not respect local DNS and it report outside:

1 Like

This works, thank you. I tested on the Tuya app it shows offline but it works locally on HA. Hopefully it stays that way. :handshake:

I’m a bit confused. From the screen cap provided that just seems to be blocking all local LAN IP addresses - wouldn’t that have the same effect? Which line is blocking access to WAN addresses - is it the bottom one?

First 5 rules translate in: Block traffic if destination is NOT RFC1918 ( local IP’s).
Notice the sign ! in front of RFC1918, that is NOT

It does block WAN that’s for sure, but it doesn’t have the desired effect… it still goes unavailable on HA including the toggle and values if I enable this rule.

For me it work with an older version of Local Tuya and plugs in different LAN segment for more than a year.
I think you have other configuration problem in your network.
Do you have the plugs in the same LAN segment as HA because latest Local Tuya will not work if plugs are in different LAN…

HA and tuya plugs are in different vlans, read blocking dns can help?.

1 Like

Does anybody here have a Tuya power outlet with USB charger?

I as wondering if it is possible to see the main socket and the USB out using Tuya Local. It works when I use the normal Tuya integration, which shows me two switches. But Tuya Local only shows me one Switch (which turns on both outputs).

I have a multi shocket with two usb ports and each one is a separated device in HA (Sockets and usb ports), the only thing missing in my case is the power consumtion, but maybe is just in the hardware that I bought.

Thank you for your reply.
I now decided to move away from the Tuya and Tuya Local integrations and flashed Tasmota. :slight_smile:

Have you figured this out yet?
If not, Mark here helped me out. Check it out.

Anyone can help me intregrate this model??
I have add the local tuya integration, but i don’t know how to integrate the energy reads, the switch is ok.

You have to create those 3 sensors cause the values current, voltage and current_consumption are shown in your screenshot. I doubt that your states access is helpfull and you will not need Amps and Voltage cause W is king of power needed for energy calculation.

sensor:
  - platform: template  
    sensors:
      power_office: 
        icon_template:       'mdi:router-wireless'
        value_template:      "{{ state_attr ('switch.buero', 'current_consumption') }}"

You have to replace your line

value_template: >-{{ states.switch.plasma_main_gosund_sp112.attributes.current_consumption }}
by this one
value_template:      "{{ state_attr ('switch.buero', 'current_consumption') }}"

You need to show the values of your sensor which can be found under the developer tools add a screen shot of the plug like shown here
You can see on the right half current 0 and Curr_consumption is 0 too, but voltage 227,1 v.

If that is the case you can integrate it as usual.

Here are the infos that i have.
Captura de tela 2021-06-09 233953

I don’t know what values to pick in each field to make the sensors work.
The Button switch worked like a charme, but the sensors didnt.

ah, that is a complete different world cause you are in the setup process.

It is called a WiFi plug for Brazil so I guess you are brazilian, which means 60% of the households are running 127 V and the others 220 V.

But first of all you will choose switch (it is a switched plug).

From now on it is a bit of guesswork without destroying anything - except giving you wrong numbers in the false contents like it will show you Watts where the figure displays voltage.
Do not forget the setting here are just statistics that could go wrong, no one will be hurt.

I can see a few values we have to bring in an order where they might fit. I do not see a 127 like figure so I assume you are running at most likely 240 Volts. That might be shown in the value 25 … with 1 decimal, so I guess 245,0 V at time of screenshort.
Yes it is guesswork, but it explains how it will work out. You also have to show the values above 38 cause the scrollbar shows that there are more values.

23 and 24 might be the consumption of the day and week or so cause these are big values of 17033 and 29314 … which might fit in a consumption of day before and the current day if you had taken the screenshot on 2nd day of running in the evening not midnight. You will need the 23 and 24 most likely later, but it is just the way to sort things out.

We have to find the basic 3 figures for this equation: Voltage x Current = Current consumption as you can see in the left half of the screenshot

The easiest way to get it right is a device you know of that the watts promised are delivered like a hairdryer full throttle or a water kettle, not a chines 2800 W figure that is fake and delivers just 40%.

The first test will be to watch for the figures that are changing from 0 if you turn the device on and then back to 0 after you had turned it off. those both figures are the watts and the current, most likely mA.

Then you do a screen shot before running the second test, a full throttle 1 minute test, then while running a second screenshot of both parts. Now you will see the figures that will have increased from beginning to end and those are the energy or Wh counters.

Make sure you do upper and lower screen shot of the values below item 38 … before and after so we get 6 screenshots or better you write the figure of the dsp 1 to whatever down in a row (at least those who had once shown a different value than 0).

But first test is most valueable one cause turning on / off will show you the Volt and Ampere fields (not know which is what) … cause Volt will stay the same regardless if turned on or off.

If you have found the 3 fields and figures we need do the math of VOLT x AMPERE = Watt and search for that whatever cause that is your Watt or here called Current Consumption figure.

You can also check the counters and their increase. You can use them to verify. For example if you use a 1200 W cooker for 2 min than that energy meter , the counter of Wh, should go up 2 / 60 h x 1200 W = 40 Wh
Check it out if you can find a figure that is afterwards 40xx bigger than before. It is just another proof what the counters are.

Just do the test and put 1 screenshot here while running and write the figures down to all the fields that had changed while the test using the CODING format cause then we can see the colums right aligned.

Switch      Before     while    after
20          2242        xyz      abc
21             1         12       34
22           638        638      638 

Easier for you and me to discuss.

Dude, thank u so much for explaining me. I will do the tests u asked me.

1 Like