Energy consumption and Arlec Grid Connect (Tuya) smart plug

Yes, sadly this is the case. Some devices work in the original tuya integration, but not in the new one and some devices work in the new tuya integration but not in the old. The number of devices that are supported in the new integration are increasing (whilst the old version was pretty stagnant), so there is hope.

When you say “make sure” do you mean, make it up ?

is the “sensor” something that I am defining or should I be able to find it somewhere?

I have made the name stablepwr and the sensor sensor.stablepwr1

Ah. No. As described earlier in this thread:
“From the Lovelace gui interface, go into Configuration, then Integrations, find the Tuya2 integration then click on the “devices” hyperlink. Now find the Tuya device”

Click on the sensor and use that name to be the data source for the extra sensor you are creating for energy monitoring.

Well I must not have noticed that bit. oops.

Well I’ve added the TuyaV2 repository in HACS, it says it’s installed. But I can’t add it to integrations. It’s just not there, even after a restart.

Ideas?

Apparently I just have to wait lol

Ok i spend hours now trying to install tuya v2.
“Config flow could not be loaded” after install.
If i click on integrations after restarts it loads forever.
Tried to uninstall tuya from hacs and repeat process but no luck.

Ah. OK. Assuming you have the latest HA, TuyaV2 is installed normally ie not via HACS, and is just called Tuya. Just to clear up your install, I’d suggest removing the HACS version and any other Tuya install, restarting, then following the instructions (Tuya - Home Assistant) to add in the native Tuya integration.

Thank you for this Post zagnuts. I got my Arlec Grid Connect SMART plug collecting kwh.
I didn’t have any sensors in my configuration.yaml file so I added a line in the same file:
sensor: !include sensor.yaml

Then I created a file called sensor.yaml in the same folder and added:

- platform: integration
  source: sensor.smart_plug_with_energy_meter_pc399ha_power
  name: Kitchen Hot Water Energy
  unit_prefix: k
  round: 2
  method: left

I did have issues when copying and pasting from your example, perhaps because of invisible formatting characters. Typing it out solved it for me.

For those new to this, you need to connect your smart plug using the app “Smart Life” and not Grid Connect and follow the TUYA integrations guide.

There was a comment above that the waterbed produced inaccurate readings. If you refer to Integration - Riemann sum integral - Home Assistant (home-assistant.io), this recommends changing the collection method for on/off heaters to left.
I am trying this out as my readings are not the same as the Smart Life reading.

1 Like

Hi. See my post at the bottom. Add a line to the yaml file
method: left

This is needed for on/off heaters.

You can see the effect in the last hour.

No problem - glad it’s working for you as well! As for the copy and paste thing - there shouldn’t have been any hidden characters but it may very well have been a formatting issue. It’s so easy for a space or tab to creep into a yaml file and break it - which why I got into the habit of always testing my code after any change no matter how minor… :slight_smile:

i have ten power sockets but does show me only one power reding any advice to see all the plugs working?

Assuming you are using the new Tuya integration then it will create ten switches and each switch will have separate sensors. To see them in the energy section have you created ten extra sensors as described above?

i already do all the steps but it still does not show me the power readings,
it’s so odd

Oooh. Was in Bunnings yesterday and found this “Arlec Grid Connect Smart IP44 Heavy Duty Timer”. It is designed to plug into an external power point, and it does energy monitoring. Cost AUD$25. Bought one to play with, and:

  • Connected it to my wifi via the Smart Life app
  • Went to hassio, reloaded the Tuya integration, and the new device was there
  • Still in hassio, went into the integration and enabled the three additional sensors
  • Once the sensors were available, I then checked the name of the power sensor which in my case was “sensor.pc44ha_power” and of course reporting power usage in W.
  • Then edited my sensor.yaml file and added:
  - platform: integration
    source: sensor.pc44ha_power
    name: Pool Fridge Energy
    unit_prefix: k
    round: 2  

After a little while, my new power monitor for the pool fridge was available to add into my energy monitoring. Yay!

Coul you please share configiration.yaml and sensor.yaml file?

Hi. Literally it is the message above. Basically you need to setup the Tuya integration (as described here: Tuya - Home Assistant), then when you add devices in via the Tuya Smart Life app, those devices that are supported will simply appear in home assistant enabling you to turn them on/off etc. The power sensors may not appear, in which case you need to enable them (as mentioned above - it’s just done via the home assistant web interface). If you want to monitor power usage over time via the ‘Energy’ tab in home assistant you can create a sensor that tracks the instant W readings to kW over time via “platform: integration” as shown above - that’s the only yaml editing you need to do, and that is in your sensor section in configuration.yaml or - if you pulled them all into a separate sensor.yaml file - in sensor.yaml.

1 Like

FYI, I bought a 4-pack of the Arlec Smart plug-in socket with energy meter (model PC191HA) from Bunnings for Aus$65.oo.
I followed instructions in the video at Get your Tuya Device Local Key - YouTube to get the Local key and Device specification attributes:

Having installed in the Tuya phone app, I used my router to associate the device MAC addresses to specific IP addresses (which happen to be blocked by the firewall).

I have installed each using the TuyaLoacal integration:

  1. Select the new device from Device ID or IP Address, with Platform of “switch” then as shown:

    plus dp_id 20 for Voltage.
  2. UN-tick the “Do not add any more entities” box, select “number”, Submit, then select dp_id of 9, name “countdown” and range 0 to 86400 (from memory, number of seconds in 1 day).
  3. Same for dp_id 38, relay_status with enumerated values “off”, “on”, and “last”.
  4. no more entities to add, so leave the “Do not add any more entities” box ticked.

The switch works, as does the countdown timer. The relay_status does not - but I can live without it for now.

I see current, current_consumption and voltage values are attributes of the “switch” entities - however they aren’t automagically made available to report on.

I had to add the YAML code from the “Energy monitoring values” section of LocalTuya documentation to my HA configuration.yaml, and they are now reporting correctly (using the custom:multiple-entity-row frontend available in HACS)
Screenshot from 2022-05-25 19-20-44

5 Likes

I also recently bought a bunnings 4-pack of these AC plugs.

Thanks to your help I’ve got it to the point where it can be controlled on/off, and report Current / Power / Voltage correctly.

I’d love to be able to accurately measure the electricity usage over time, which the Tuya app can do, and I noticed one of the device attributes is “add_ele”

Which monitored over time, does change value:

0

It says that it is measured in kW.h, with a scale of “3” and a step of “100”
…whatever that means

Maybe someone out there with better understanding, and some good math’s can turn this value into a energy consumption meter? :wink:

I think You need to convert to kWh then run a utility meter for the daily sum. This will then usable in the energy dashboard.

#Convert W on the GPO's to kWh
  - platform: integration
    source: sensor.po_master_bed_power
    name: po_master_bed_power_k
    unit_prefix: k
    round: 2
    method: left  

utility_meter:
  daily_energy_po_master_bed:
    source: sensor.po_master_bed_power_k
    name: PO Master BED kWh Daily
    cycle: daily
1 Like