Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Energy Metering Data phase_a not recognized #492

Closed
2 of 3 tasks
SolusCado opened this issue Jan 18, 2025 · 12 comments
Closed
2 of 3 tasks

[Bug]: Energy Metering Data phase_a not recognized #492

SolusCado opened this issue Jan 18, 2025 · 12 comments
Labels
enhancement New feature or request

Comments

@SolusCado
Copy link

LocalTuya Version

2024.12.1

Home Assistant Version

2025.1.2

Environment

  • Does the device work using the Home Assistant Tuya Cloud component?
  • Is this device connected to another local integration, including Home Assistant and any other tools?
  • The devices are within the same HA subnet, and they get discovered automatically when I add them

What happened?

I just installed a number of Tuya WiFi Circuit Breakers, which monitor and respond to various electrical states. The device reports all the correct data using Tuya/Xtend Tuya, but LocalTuya does not seem to understand the data that is being reported. (You can see in the log output below that it appears to be some sort of hash value: "CPUAIfsAB8o=".)

Comparing the Xtend Tuya configuration, I see three different values for "Phase A, B, and C" (so, 9 in total), but the DP data from the Tuya Developer website appears to just show a single DP node for each phase, with perhaps all three values combined in the hashed data.

Can you confirm whether this is what's happening, and if so - is there any way at all to get this data working through the LocalTuya intergation?

Steps to reproduce.

  1. Add new Device.
  2. Select WiFi Circuit Breaker from list.
  3. By default, several configuration controls and numeric sensors are added, but the sensors are not correctly labeled and only report "Unknown" data.
Image

This is what it looks like in Xtend Tuya:

Image

Relevant log output

{
        "code": "forward_energy_total",
        "custom_name": "",
        "dp_id": 1,
        "time": 1737199590600,
        "type": "value",
        "value": 16808777
      },
      {
        "code": "phase_a",
        "custom_name": "",
        "dp_id": 6,
        "time": 1737199590613,
        "type": "raw",
        "value": "CPQAN7kADGI="
      },
      {
        "code": "phase_b",
        "custom_name": "",
        "dp_id": 7,
        "time": 1737199590905,
        "type": "raw",
        "value": "CPYAIesAB8c="
      },
      {
        "code": "phase_c",
        "custom_name": "",
        "dp_id": 8,
        "time": 1737199591040,
        "type": "raw",
        "value": "CPUAIfsAB8o="
      },
      {
        "code": "leakage_current",
        "custom_name": "",
        "dp_id": 15,
        "time": 1737193650051,
        "type": "value",
        "value": 0
      },
      {
        "code": "switch",
        "custom_name": "",
        "dp_id": 16,
        "time": 1737193650051,
        "type": "bool",
        "value": true
      }

Diagnostics information.

No response

@SolusCado SolusCado added the bug Something isn't working label Jan 18, 2025
@xZetsubou
Copy link
Owner

xZetsubou commented Jan 18, 2025

Post the device diagnostics

Note: Xtend is a cloud integration if these values are reported only to cloud then it won't works locally, #259

@xZetsubou xZetsubou removed the bug Something isn't working label Jan 18, 2025
@SolusCado
Copy link
Author

SolusCado commented Jan 21, 2025

I don't know if "cloud pull" means the data is just pulled from the cloud rather than the device - but that part doesn't really concern me - it's just that I would like to be able to extract the values that are being recorded in those strings:

(It's just that the values for DPS 6-8 don't mean anything to me.)

      "dps_strings": [
        "1 ( code: forward_energy_total , value: 1033, cloud pull )",
        "6 ( code: phase_a , value: CQAADhkAAro=, cloud pull )",
        "7 ( code: phase_b , value: COAAHb8ABlU=, cloud pull )",
        "8 ( code: phase_c , value: CPgAF1oABOM=, cloud pull )",
        "15 ( code: leakage_current , value: 0, cloud pull )",
        "16 ( code: switch , value: True, cloud pull )",
        "102 ( code: ov_set , value: Trip, cloud pull )",
        "103 ( code: uv_set , value: Alarm, cloud pull )",
        "104 ( code: oc_set , value: Trip, cloud pull )",
        "105 ( code: op_set , value: Closed, cloud pull )",
        "107 ( code: temp_set , value: Trip, cloud pull )",
        "108 ( code: leak_set , value: Trip, cloud pull )",
        "109 ( code: online_state , value: online, cloud pull )",
        "110 ( code: event , value: Normal, cloud pull )",
        "112 ( code: auto_reclosing , value: False, cloud pull )",
        "113 ( code: rd_set , value: False, cloud pull )",
        "114 ( code: c_thresh , value: 63, cloud pull )",
        "115 ( code: ov_thresh , value: 280, cloud pull )",
        "116 ( code: uv_thresh , value: 165, cloud pull )",
        "117 ( code: leak_thresh , value: 30, cloud pull )",
        "118 ( code: temp_thresh , value: 800, cloud pull )",
        "119 ( code: op_thresh , value: 2000, cloud pull )",
        "125 ( code: fap_a , value: 213, cloud pull )",
        "126 ( code: fap_b , value: 469, cloud pull )",
        "127 ( code: fap_c , value: 350, cloud pull )",
        "131 ( code: temp_a , value: 219, cloud pull )",
        "132 ( code: temp_b , value: 210, cloud pull )",
        "133 ( code: temp_c , value: 204, cloud pull )",
        "134 ( code: temp_n , value: 202, cloud pull )",
        "139 ( code: power_total , value: 3570, cloud pull )"
      ],

@xZetsubou xZetsubou added the enhancement New feature or request label Jan 23, 2025
@xZetsubou xZetsubou changed the title [Bug]: Energy Metering Data not recognized [Bug]: Energy Metering Data phase_a not recognized Jan 23, 2025
@xZetsubou

This comment has been minimized.

@xZetsubou
Copy link
Owner

can you test this branch "handle_raw_sensor_data_phase_x"

@SolusCado
Copy link
Author

That seems to be getting us somewhere:

Image

I would expect though for there to be a couple more attributes - not just the total consumption, but also current amps, voltage, etc...

@xZetsubou
Copy link
Owner

By default this DP is not active it may or may not return the state instantly of the DP so give it a time until it's updated then it should create current amps, voltage and power

does this "Office Test" is mapped to DP 6 or 7 or 8? if so wait for it till it updates.

@SolusCado
Copy link
Author

This is actually a different breaker (single-pole), so it ONLY reports Phase A (DP 6). The 3-pole is my main house breaker, and I don't want to test with it more than necessary. :D

BTW... the data is now showing the hashed value again:

Image

@xZetsubou
Copy link
Owner

xZetsubou commented Jan 24, 2025

If the data is now showing, check if current, voltage, and power entities have been created. They should exists on the device page

@SolusCado
Copy link
Author

Image

Looking good, I think?

@xZetsubou
Copy link
Owner

Yes, I think the power needs to scale as well.

@SolusCado
Copy link
Author

Yes, I think the power needs to scale as well.

:) Yeah; I'm not running a factory over here!

@xZetsubou xZetsubou added the master/next-release Fixed in master branch, Will be ready in the next release label Jan 24, 2025
Copy link

This issue was closed because it was resolved on the release: 2025.2.0

@github-actions github-actions bot added stale and removed master/next-release Fixed in master branch, Will be ready in the next release stale labels Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants