rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
2.74k stars 533 forks source link

Energy meter partially recognized #728

Open Pico1965 opened 2 years ago

Pico1965 commented 2 years ago

Good evening. I ask another question in the hope that he will have better luck than the previous ones. I bought a Chinese Tuya energy meter. In the App. shows voltage, current, power and energy. The device is recognized by LocalTuya with only 4 DPs but only the total energy is managed. immagine How can I also manage the current, voltage and power values?

Thanks for your attention

mihaimdinca commented 2 years ago

I did some googling and found out there is another DP which is not made available by the configuration flow (DP6). At this datapoint you can read text that by conversion gets transformed to Voltage, Current and Power. I was able to read the DP by adding a new sensor in config.yaml. I am new in home assistant, python and yaml and I am still trying to figure things out. My understanding is that the string needs to be encoded to ASCII and the decoded to base64. The first 16 bits are the voltage, the next 24 bits are current and last 24 bits are power.

mihaimdinca commented 2 years ago

All the info above are derived from this post. https://github.com/jasonacox/tinytuya/issues/55 I did the checking I could with my device (a Tuya compatibile chinese made Hiking DDS-238-4 single fase protective meter). Got stuck in the programing. Hoping for some support from the developers of Local Tuya ;)

Pico1965 commented 2 years ago

Thanks for your contribution. I hope so too for some support from the developers of Local Tuya

I was able to read the DP by adding a new sensor in config.yaml.

How?

Pico1965 commented 2 years ago

Sorry ... I don't want to be pretentious ...

Has the problem been taken over by someone or ... is that okay?

mihaimdinca commented 2 years ago

Thanks for your contribution. I hope so too for some support from the developers of Local Tuya

I was able to read the DP by adding a new sensor in config.yaml.

How? by adding the following code to the configuration.yaml file localtuya:

  • host: 192.168.1.108 device_id: !your meter's device id local_key: !the local key for the meter friendly_name: AZ-5 (any name) protocol_version: "3.3" entities:
  • platform: sensor friendly_name: VPI (any name) id: 6

the state of the sensor looks more or less like this CQYAB/oAAXQ== (this is the actual example from the tinytuya post)

Pico1965 commented 2 years ago

Thanks but is too difficult to me.

The question in my previous post was addressed to the admins to find out if anyone was working on a component patch since the platform does not give the problem assigned to someone.

JeffersM1 commented 2 years ago

Good evening. I ask another question in the hope that he will have better luck than the previous ones. I bought a Chinese Tuya energy meter. In the App. shows voltage, current, power and energy. The device is recognized by LocalTuya with only 4 DPs but only the total energy is managed. immagine How can I also manage the current, voltage and power values?

Thanks for your attention

What brand of power meter are you trying to use? I had a Bituo PG-01 meter working in HA Local Tuya, but can no longer read values from it. I saw on another post that the Shelby EM has worked well for many. I have found some local suppliers for it, and the price is reasonable, so I have one on order.

mihaimdinca commented 2 years ago

It is a Hiking DDS-238-4 single phase meter. I can read the total energy value directly and I can use it as a switch. The voltage, power and current are all on the same data point and the value is in some text format. I posted my findings on the subject earlier. Some tinyTuya folks ( https://github.com/jasonacox/tinytuya/issues/55) may have found the solution on how to convert it to the actual values. I lack the python knowledge to implement it myself. I hope you have the time and skills as it will be greatly appreciated.

On Sat, Apr 9, 2022, 17:37 JeffersM1 @.***> wrote:

Good evening. I ask another question in the hope that he will have better luck than the previous ones. I bought a Chinese Tuya energy meter. In the App. shows voltage, current, power and energy. The device is recognized by LocalTuya with only 4 DPs but only the total energy is managed. [image: immagine] https://user-images.githubusercontent.com/96646106/152017991-72353d69-5b19-4715-95e2-34bdf779f02e.png How can I also manage the current, voltage and power values?

Thanks for your attention

What brand of power meter are you trying to use? I had a Bituo PG-01 meter working in HA Local Tuya, but can no longer read values from it. I saw on another post that the Shelby EM has worked well for many. I have found some local suppliers for it, and the price is reasonable, so I have one on order.

— Reply to this email directly, view it on GitHub https://github.com/rospogrigio/localtuya/issues/728#issuecomment-1094049238, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXGYEQFFWYSCCF3JQIJZGA3VEGI37ANCNFSM5NJZPCHA . You are receiving this because you commented.Message ID: @.***>

Pico1965 commented 2 years ago

What brand of power meter are you trying to use?

This

Given that nothing is owed to me / us, I'd like to know if it's just my problem, a problem with my device, a problem with the addon and, above all, if someone is working on a solution.

JeffersM1 commented 2 years ago

I was going to replace the Bituo meter that I am started problems with connecting to with a TOMZN DSS238-1 WiFi. After reading about these problems, I'm glad I didn't order one from AliExpress.

mihaimdinca commented 2 years ago

Any progress on this front? I do not have the Python skills but it seems to be a matter of converting the text made available at DP6 to the V, P and I values as described in the tinyTuya post. Please help!

mihaimdinca commented 1 year ago

Is there any way to read DPs that do not show up in the configuration flow now that configuration.yaml cannot be used anymore?