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

Tuya - incorrect scaling of current (amps) value #116031

Open
wasp100 opened this issue Apr 23, 2024 · 6 comments
Open

Tuya - incorrect scaling of current (amps) value #116031

wasp100 opened this issue Apr 23, 2024 · 6 comments
Assignees

Comments

@wasp100
Copy link

wasp100 commented Apr 23, 2024

The problem

I’ve recently connected a Tuya smart switch rated at 30 amps to control the water heater. I’ve integrated into Home Assistant using the official Tuya app.
I’ve noticed that the current shown in the Tuya app is correct at 18A, however in HA, it shows as 0.018A!!
It is wrong by a factor of a 1000.
Can we please fix?

What version of Home Assistant Core has the issue?

2024.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Tuya

Link to integration documentation on our website

https://www.home-assistant.io/integrations/tuya/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

I have another Tuya smart switch controlling a pool pump (which draws about 5A) and this amp value is correct in HA. Could it be perhaps a limit in the code for the current drawn in HA? Perhaps, if it’s greater than 10A, it shows the wrong value??

@home-assistant
Copy link

Hey there @tuya, @zlinoliver, @frenck, mind taking a look at this issue as it has been labeled with an integration (tuya) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of tuya can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign tuya Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


tuya documentation
tuya source
(message by IssueLinks)

@wasp100
Copy link
Author

wasp100 commented May 4, 2024

Hi! Any feedback on this @frenck ? Thanks

@wasp100
Copy link
Author

wasp100 commented Jun 7, 2024

@frenck can you please advise? Seems like HA is showing the mA value as an Amp value hence the value is out by a factor of a 1000.

@frenck
Copy link
Member

frenck commented Jun 7, 2024

Please attach a download of the diagnostic of this device from Home Assistant and attach it to this issue (as requested by the issue template as well).

Thanks already 👍

../Frenck

@wasp100
Copy link
Author

wasp100 commented Jun 7, 2024

Hi @frenck , see below extract of diagnostic:
I see the current is being measured in mA. I've drawn the diagnostics of another tuya device and that shows Amps. I can't seem to understand why the one device is measuring in mA and the other in Amps

"function": {
  "switch_1": {
    "type": "Boolean",
    "value": {}
  },
  "countdown_1": {
    "type": "Integer",
    "value": {
      "unit": "s",
      "min": 0,
      "max": 86400,
      "scale": 0,
      "step": 1
    }
  },
  "relay_status": {
    "type": "Enum",
    "value": {
      "range": [
        "power_off",
        "power_on",
        "last"
      ]
    }
  }
},
"status_range": {
  "switch_1": {
    "type": "Boolean",
    "value": {}
  },
  "countdown_1": {
    "type": "Integer",
    "value": {
      "unit": "s",
      "min": 0,
      "max": 86400,
      "scale": 0,
      "step": 1
    }
  },
  "relay_status": {
    "type": "Enum",
    "value": {
      "range": [
        "power_off",
        "power_on",
        "last"
      ]
    }
  },
  "add_ele": {
    "type": "Integer",
    "value": {
      "unit": "kwh",
      "min": 0,
      "max": 50000,
      "scale": 3,
      "step": 100
    }
  },
  "cur_current": {
    "type": "Integer",
    "value": {
      "unit": "mA",
      "min": 0,
      "max": 30000,
      "scale": 3,
      "step": 1
    }
  },
  "cur_voltage": {
    "type": "Integer",
    "value": {
      "unit": "V",
      "min": 0,
      "max": 5000,
      "scale": 1,
      "step": 1
    }
  },
  "cur_power": {
    "type": "Integer",
    "value": {
      "unit": "W",
      "min": 0,
      "max": 80000,
      "scale": 1,
      "step": 1
    }
  }
},
"status": {
  "switch_1": false,
  "countdown_1": 0,
  "relay_status": "power_off",
  "add_ele": 100,
  "cur_current": 0,
  "cur_voltage": 2397,
  "cur_power": 0

@wasp100
Copy link
Author

wasp100 commented Jun 7, 2024

Diagnostics of the other Tuya device shows current in Amps (which is correct)
"cur_current": {
"type": "Integer",
"value": {
"unit": "A",
"min": 0,
"max": 50000,
"scale": 3,
"step": 100
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants