Tuya Smart Energy Sensor - Solar Plug & Play

Hi All

this is my first post on Home Assistant Forum, sorry if there is any mistake on category selection
I Need your help for a very big headhake issue that I’m facing.

I have purchased a Tuya Smrat Meter (directional) on Aliexpress (same one that you can find on AMZ), that should read electricity passing through a wire. https://it.aliexpress.com/item/1005005455143742.html?spm=a2g0o.order_list.order_list_main.17.1bea3696QY8CyR&gatewayAdapt=glo2ita

I placed the magnet around the Load wire (Brown) coming from by electricity company meter.
And here start the problem.
I have a solar installation that produce up to 600W. I Leave in an apartment with a terrace, so i choose a Plug & Play system. Works amazing and I love it.
It is smart and integrated with Home Assistant, so I can import reads of production. This part works fine just fine.
But.
Importing in home assistant Tuya Smart Meter I have noticed an issue
If the solar produce more electricity than the House is requiring, Tuya meter read positive electricity, like the house is requiring from the grid, but it is not like this. If I go to the “meter” from the electrcity company, it read “0” since housw is using solar power.
Example.
Solar is producing 500W
My house is requiring 200W, Tuya smart meter reads 300W positive.
I have created an helper on Home assistant.
Tuya - Solar = Home consumption. Perfect… NOT
If the house is requiring less power than Solar production, my Helper reads negative values. So It is like House is not using any elctricity and the difference goes into the grid

This is my helper
template:

  • sensor:
    • name: “Consumo Totale Casa”
      unit_of_measurement: “Wh”
      device_class: energy
      state_class: total_increasing
      state: “{{ (states(‘sensor.consumo_casa’) | float(0) - states(‘sensor.shellyplug_s_80646f8259f7_power’) | float(0)) / 1 }}”
      icon: mdi:transmission-tower-export

It is like Tuya smart meter is reading also electricty that solar panel are producing and the house is not using.

It is been sold to me as a directional meeter, there’s also an arrow on the magnet to indicate the electricity flow direction. I have checked and I have installed correctly

How can I configure it as reading only for real grid consumption?

Did you manage to connect your equipment to the Tuya local network?

I have a sensor of this model, I already got the information on the IOT Platform, but it only gives me a login error.

https://it.aliexpress.com/item/1005005994889019.html?spm=a2g0o.productlist.main.13.4f38kQI4kQI4OX&algo_pvid=b5be9b0d-a0d8-4ed5-81f2-bf0943fb811b&aem_p4p_detail=20231212112423395301579720230000332585&algo_exp_id=b5be9b0d-a0d8-4ed5-81f2-bf0943fb811b-6&pdp_npi=4%40dis!BRL!139.60!114.46!!!26.93!!%40210307bf17024090627631349e520d!12000035221970666!sea!BR!0!AB&curPageLogUid=trDPCvxPyfKf&search_p4p_id=20231212112423395301579720230000332585_7

I have exactly the same problem, readings are always positive, so injection is not detected.

  1. If you got a smart micro inverter (with your solar panels) that can be connected to HA, you should use this value for solar power reading. Unfortunately mine return 0

  2. Check other local tuya integration, I have found a fork that works

New repo :

Added integration (the second one) :

New sensors detected (with a lot more infos) :