Wifi power switches turn on and off, show Voltage ... but not Amps or Watts

TL;DR wifi power switches are connected, responding to turn_on and turn_off, monitoring Voltage … but mostly not showing the Amps or Watts when turned on !

I’m not even sure whether this is hardware, localTuya or something else :frowning:

I have added some Arlec PC191HA wifi power switches using localTuya. They show and update the switch status instantly, and show the voltage … but only sometimes show the Amps or watts !

image
These are all PC191HA switches, and as you can see all currently switched ON. All show a voltage.
At first glance this appears reasonable - switch is connected to voltage even when the devices plugged into the switches are not operating.

However as I write this the heater in the bedroom has been heating the bedroom for 10 minutes, there is no phone plugged into the bedroom charger, pc191ha-107 currently has a desk lamp shining on my desk, and pc191ha-109 is powering a RasPi 1B drawing about 1/2 Amp.

  1. For a while i have been assuming that maybe they have been dropping off my wifi, since (a) my study is a poor reception area, and (b) I re-purposed an old wifi router (which i discovered today only allows 15 connected devices) - but I have today been checking the Wireless statistics and the device MAC addresses are connected.

  2. Check for faulty hardware. I disabled the router firewall rules to block IoT devices from the internet, and (after a while) the Tuya phone app saw the devices online, and did report power usage as well as the voltage and switch status. So, NOT a hardware fault. Turned the firewall rules back on, and after a while the tuya phone app shows all devices as disconnected.

  3. Check the installation. the DP_ID information I previously obtained from the Tuya website is:


    Interestingly the HA localTuya integration aslo shows values for additional DP_IDs numbered 21-26 but of course no description.

Lets pick on the switch with the desk lamp connected and IP address ending in 107. The device appears OK
image

but probably best to show the detail of configuration

clicking [submit] gives the switch details:
image

Now, i know I could have set up sensors for Current, Consumption and Voltage … but when I tried the first unit I found a forum post which created sensors from attributes in configuration.yaml. But it is such a pain that I copied and pasted the code for the first unit:

sensor:
  - platform: template
    sensors:
      # Arlec PC191HA power switches
      # The localTuya integration reports power usage as attributes on the switch entity
      #   so we need to extract them as individual entities.
      # Believe me, doing it this way is better than creating lots of separate 
      #   sensor entities when creating the devices in the integration
     ...
      #  
      pc191ha_107_voltage:
        value_template: "{{ state_attr('switch.pc191ha_107', 'voltage') }}"
        unit_of_measurement: 'V'
      pc191ha_107_current:
        value_template: "{{ state_attr('switch.pc191ha_107', 'current') }}"
        unit_of_measurement: 'mA'
      pc191ha_107_current_consumption:
        value_template: "{{ state_attr('switch.pc191ha_107', 'current_consumption') }}"
        unit_of_measurement: 'W'
  1. OK, that’s how it is configured. So, what is it reporting ? In HA Developer Tools > States we see:

so It looks as though the switch attributes are being translated to separate sensors. Maybe this step is causing a delay ? Probably, but after 10 minutes the fan heater still had registered only Voltage.

Why Voltage has a value, but Current or Consumption are zero ?


To add to the weirdness, today I moved a couple of the units around physically. I decided it would be easier to compare if I was using my TP-Link switches on the fridge and freezers … and the pc191ha-109 was one that was re-purposed. Several of the units (including 107) have physically moved so not a power off/on reset.

I have restarted the integration, and restarted HA … each several times.

Any ideas ? What have i missed ? What else can I check ?

FWIW I have deleted and re-configured my switch 107 adding entities for all the exposed DP-IDs. Curiously, after configuring the number entity “countdown” for DP_ID 9, that DP_ID 17 (add_ele with unit of “kW h” on theTuya website) disappeared from the localTuya select list.

With switch 107 connected to wi-fi, and a desk lamp connected and powered on for over 10 minutes, these are the results in Developer Tools > States (sorry about the formatting, but a screen image is too big):

Entity State Attributes
number.pc191ha_107_countdown
pc191ha-107_countdown
0 min: 0 max: 86400 step: 1 mode: auto
friendly_name: pc191ha-107_countdown
number.pc191ha_107_current
pc191ha-107_current
0 min: 0 max: 30000 step: 1 mode: auto
friendly_name: pc191ha-107_current
number.pc191ha_107_dp21
pc191ha-107_dp21
1 min: 0 max: 100000 step: 1 mode: auto
friendly_name: pc191ha-107_dp21
number.pc191ha_107_dp22
pc191ha-107_dp22
541 min: 0 max: 100000 step: 1 mode: auto
friendly_name: pc191ha-107_dp22
number.pc191ha_107_dp23
pc191ha-107_dp23
29057 min: 0 max: 100000 step: 1 mode: auto
friendly_name: pc191ha-107_dp23
number.pc191ha_107_dp24
pc191ha-107_dp24
15274 min: 0 max: 100000 step: 1 mode: auto
friendly_name: pc191ha-107_dp24
number.pc191ha_107_dp25
pc191ha-107_dp25
2730 min: 0 max: 100000 step: 1 mode: auto
friendly_name: pc191ha-107_dp25
number.pc191ha_107_dp26
pc191ha-107_dp26
0 min: 0 max: 100000 step: 1 mode: auto
friendly_name: pc191ha-107_dp26
number.pc191ha_107_power
pc191ha-107_power
0 min: 0 max: 80000 step: 1 mode: auto
friendly_name: pc191ha-107_power
number.pc191ha_107_voltage
pc191ha-107_voltage
2433 min: 0 max: 5000 step: 1 mode: auto
friendly_name: pc191ha-107_voltage
select.pc191ha_107_relay_status
pc191ha-107_relay_status
unavailable options: power_on, power_off, last
friendly_name: pc191ha-107_relay_status
switch.pc191ha_107
pc191ha-107
on friendly_name: pc191ha-107
current: 0
current_consumption: 0
voltage: 243.3

Note in the last row that I have attribute for voltage showing a value, but after 10 minutes use there is still zero values for current and current_consumption (which i called “power” in the number entity for DP_ID 18)

Maybe it’s time to do a full reinstall on a new SD card … to remove any confusion caused by renaming entities and other false starts

I experienced something similar, the sensors work for heavy loads (fridge, washer), not for lamps, etc.

That’s what I thought, and so I left a fan heater running for 20 minutes on one of the switches … still no amps reported.

I’ve got one switch still reporting a voltage, despite it being physically disconnected from power for a couple of days - and my wi-fi is dropping devices :frowning:

I have got a new Wireless AP on the way, and will do some more thorough testing when i can monitor the wi-fi connection to these devices … hopefully later this week.

I should have followed up earlier - sorrry !

All is well now. I’m pretty sure I deleted all the devices and LocalTuya integration, restarted a couple of times, and reinstalled.

Glad you got it sorted. I’m about to copy your last course of action and remove/delete devices and the integration. Hopefully all ends well.

Everything was working when in tuya cloud, but things started breaking on the move to local

Haha, I did a thing.

I used CloudCutter to free my PC191HA power plugs from Tuya’s cloud. It wasn’t too difficult to do, and even has options to retain the Tuya Device_id and Local_key so I don’t have to delete them and recreate in LocalTuya.

I can now see the on/off status and switch them on/off … but I found they are not reporting voltage, current or current_consumption. My guess is that it’s LocalTuya being delicate, and deleting and adding the devices again will fix it.

But instead I’m looking at the other CloudCutter benefit - ability to upload alternate firmware OTA ! I am hoping to install ESPHome; or more specifically the libreTuya-esphome fork.

sorry for old thread but woudl you recommend these switches? I see you’re in australia and I am trying to move off zigbee. looking for wifi switches that are locally run ideally.

Hi Joel,
Due to problems with wi-fi drop-outs I decided to move to zigbee for new devices … however I had connection problems with zigbee as well. I believe I have resolved the major issues with both networks (a second WAP, and rebuilding zigbee mesh with routers first), but have been waiting and watching to check that they are now stable.

As for the PC191HS’s; I currently have 2 running ESPhome, and 3 still running Tuya (swapped from LocalTuya to the TuyaLocal integration). I want to move totally away from Tuya … but I haven’t found an ESPHome profile for my M515EGWT chain curtain motor which allows the upper and lower limits to be reset :frowning:

I have been following the Australia - Electrically Certified Hardware thread, where there are numerous reports of all brands of cheaper power switches start to fail after 12 months. I haven’t had my PC191HA’s 12 months yet, so, while they seem OK, I wouldn’t go so far as recommending them.

I am personally very happy with my TP-Link KP115 power switches … but they are no longer available, and the Tapo ones look the same but use different firmware.