xZetsubou / hass-localtuya

🔹 A Home Assistant integration to handle Tuya devices locally "fork from localtuya"
https://xzetsubou.github.io/hass-localtuya/
GNU General Public License v3.0
366 stars 41 forks source link

[Bug]: How should multiple sets of data be set within a DP point? #259

Closed fhleo closed 2 months ago

fhleo commented 3 months ago

LocalTuya Version

2024.5.0

Home Assistant Version

2024.5.4

Environment

What happened?

Hello, I have a circuit breaker that can monitor voltage, current, and power. These three attributes are all within one DP point, and calculations are needed to obtain specific values. How should I set it up to achieve this?

Steps to reproduce.

6 ( code: phase_a , value: CJUAAE8AAAg=, cloud pull )

string = "CJUAAE8AAAg=" buf = base64.b64decode(string) voltage = (buf[1] | buf[0] << 8) / 10 current = (buf[4] | buf[3] << 8) / 1000 power = buf[7] | buf[6] << 8

Relevant log output

No response

Diagnostics information.

No response

andrus2049 commented 3 months ago

See a possible solution discussed here, I use it with hass-localtuya.

https://github.com/rospogrigio/localtuya/issues/1193#issuecomment-1951057842

github-actions[bot] commented 2 months ago

This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.

fhleo commented 2 months ago

"Hello, I would like to ask if the Sensor can support base64 data."

xZetsubou commented 2 months ago

I can't say that it's really "impossible" to do that but it's kinda complicated to implement this with the way LT works.

LocalTuya uses the DP ID as the unique ID to determined which entity we are working so create 3 entities within the same DP ID may require a workaround if it's possible.

I'm not sure If I have a device had power data as base64 to test on this also make it not in my priority.

fhleo commented 1 month ago

I can use Tuya Local to achieve this feature; Is it possible to learn from it?