home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.75k stars 28.91k forks source link

TUYA Values of Power are 10x too high #110150

Open GernotAlthammer opened 4 months ago

GernotAlthammer commented 4 months ago

The problem

After the HA OS update the Tuya integration aks for re-connection. Re-connection done, but afterwards two Smart Power Plugs report wrong Power values. The Power values are 10x higher than the calulated value from voltage x current

image

What version of Home Assistant Core has the issue?

core-2024.2.1

What was the last working version of Home Assistant Core?

core-2024.1.1

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

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2024.2.1",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.12.1",
    "docker": true,
    "arch": "aarch64",
    "timezone": "Europe/Berlin",
    "os_name": "Linux",
    "os_version": "6.1.63-haos-raspi",
    "supervisor": "2024.01.1",
    "host_os": "Home Assistant OS 11.5",
    "docker_version": "24.0.7",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "speedport": {
      "version": "0.3.3",
      "requirements": [
        "speedport-api==0.5.6"
      ]
    },
    "dwd_pollenflug": {
      "version": "1.0.2",
      "requirements": [
        "pytz"
      ]
    },
    "localtuya": {
      "version": "5.2.1",
      "requirements": []
    },
    "hacs": {
      "version": "1.34.0",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "tapo_control": {
      "version": "5.4.13",
      "requirements": [
        "pytapo==3.3.18"
      ]
    },
    "keba": {
      "version": "2.4.0",
      "requirements": [
        "keba-kecontact==2.4.0"
      ]
    },
    "waste_collection_schedule": {
      "version": "1.45.1",
      "requirements": [
        "icalendar",
        "recurring_ical_events",
        "icalevents",
        "beautifulsoup4",
        "lxml"
      ]
    },
    "sonoff": {
      "version": "3.5.4",
      "requirements": [
        "pycryptodome>=3.6.6"
      ]
    }
  },
  "integration_manifest": {
    "domain": "tuya",
    "name": "Tuya",
    "codeowners": [
      "@Tuya",
      "@zlinoliver",
      "@frenck"
    ],
    "config_flow": true,
    "dependencies": [
      "ffmpeg"
    ],
    "dhcp": [
      {
        "macaddress": "105A17*"
      },
      {
        "macaddress": "10D561*"
      },
      {
        "macaddress": "1869D8*"
      },
      {
        "macaddress": "381F8D*"
      },
      {
        "macaddress": "508A06*"
      },
      {
        "macaddress": "68572D*"
      },
      {
        "macaddress": "708976*"
      },
      {
        "macaddress": "7CF666*"
      },
      {
        "macaddress": "84E342*"
      },
      {
        "macaddress": "D4A651*"
      },
      {
        "macaddress": "D81F12*"
      }
    ],
    "documentation": "https://www.home-assistant.io/integrations/tuya",
    "integration_type": "hub",
    "iot_class": "cloud_push",
    "loggers": [
      "tuya_iot"
    ],
    "requirements": [
      "tuya-device-sharing-sdk==0.1.9"
    ],
    "is_built_in": true
  },
  "data": {
    "endpoint": "https://apigw.tuyaeu.com",
    "terminal_id": "1707509158301aP0usM",
    "mqtt_connected": true,
    "disabled_by": null,
    "disabled_polling": false,
    "id": "bf5478be7742c31711a1za",
    "name": "Stecker 5",
    "category": "cz",
    "product_id": "9zynrkxe5tys0rja",
    "product_name": "ANTELA Smart Plug",
    "online": true,
    "sub": false,
    "time_zone": "+01:00",
    "active_time": "2024-01-23T20:33:15+00:00",
    "create_time": "2024-01-23T20:33:15+00:00",
    "update_time": "2024-01-23T20:33:15+00:00",
    "function": {
      "switch_1": {
        "type": "Boolean",
        "value": {}
      },
      "relay_status": {
        "type": "Enum",
        "value": {
          "range": [
            "power_off",
            "power_on",
            "last"
          ]
        }
      },
      "light_mode": {
        "type": "Enum",
        "value": {
          "range": [
            "none",
            "relay",
            "pos"
          ]
        }
      }
    },
    "status_range": {
      "switch_1": {
        "type": "Boolean",
        "value": {}
      },
      "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": 0,
          "step": 1
        }
      },
      "cur_power": {
        "type": "Integer",
        "value": {
          "unit": "W",
          "min": 0,
          "max": 50000,
          "scale": 0,
          "step": 1
        }
      },
      "cur_voltage": {
        "type": "Integer",
        "value": {
          "unit": "V",
          "min": 0,
          "max": 5000,
          "scale": 1,
          "step": 1
        }
      },
      "voltage_coe": {
        "type": "Integer",
        "value": {
          "unit": "",
          "min": 0,
          "max": 1000000,
          "scale": 0,
          "step": 1
        }
      },
      "electric_coe": {
        "type": "Integer",
        "value": {
          "unit": "",
          "min": 0,
          "max": 1000000,
          "scale": 0,
          "step": 1
        }
      },
      "power_coe": {
        "type": "Integer",
        "value": {
          "unit": "",
          "min": 0,
          "max": 1000000,
          "scale": 0,
          "step": 1
        }
      },
      "relay_status": {
        "type": "Enum",
        "value": {
          "range": [
            "power_off",
            "power_on",
            "last"
          ]
        }
      },
      "light_mode": {
        "type": "Enum",
        "value": {
          "range": [
            "none",
            "relay",
            "pos"
          ]
        }
      }
    },
    "status": {
      "switch_1": true,
      "add_ele": 20,
      "cur_current": 57,
      "cur_power": 128,
      "cur_voltage": 2231,
      "voltage_coe": 560,
      "electric_coe": 27944,
      "power_coe": 14896,
      "relay_status": "on",
      "light_mode": "relay"
    },
    "home_assistant": {
      "name": "Stecker 5",
      "name_by_user": null,
      "disabled": false,
      "disabled_by": null,
      "entities": [
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": null,
          "device_class": null,
          "original_device_class": "outlet",
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "switch.stecker_5_sockel_1",
            "state": "on",
            "attributes": {
              "device_class": "outlet",
              "friendly_name": "Stecker 5"
            },
            "last_changed": "2024-02-09T20:19:47.400092+00:00",
            "last_updated": "2024-02-09T20:19:47.400092+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "select.stecker_5_verhalten_beim_einschalten",
            "state": "unknown",
            "attributes": {
              "options": [
                "power_off",
                "power_on",
                "last"
              ],
              "friendly_name": "Stecker 5 Verhalten beim Einschalten"
            },
            "last_changed": "2024-02-09T20:16:52.760007+00:00",
            "last_updated": "2024-02-09T20:16:52.760007+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "select.stecker_5_anzeigelichtmodus",
            "state": "relay",
            "attributes": {
              "options": [
                "none",
                "relay",
                "pos"
              ],
              "friendly_name": "Stecker 5 Anzeigelichtmodus"
            },
            "last_changed": "2024-02-09T20:16:52.760885+00:00",
            "last_updated": "2024-02-09T20:16:52.760885+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": null,
          "device_class": null,
          "original_device_class": "current",
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": "A",
          "state": {
            "entity_id": "sensor.stecker_5_stromstarke",
            "state": "0.057",
            "attributes": {
              "state_class": "measurement",
              "unit_of_measurement": "A",
              "device_class": "current",
              "friendly_name": "Stecker 5 Stromst\u00e4rke"
            },
            "last_changed": "2024-02-09T20:20:20.957647+00:00",
            "last_updated": "2024-02-09T20:20:20.957647+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": null,
          "device_class": null,
          "original_device_class": "power",
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": "W",
          "state": {
            "entity_id": "sensor.stecker_5_leistung",
            "state": "128.0",
            "attributes": {
              "state_class": "measurement",
              "unit_of_measurement": "W",
              "device_class": "power",
              "friendly_name": "Stecker 5 Leistung"
            },
            "last_changed": "2024-02-09T20:21:50.467285+00:00",
            "last_updated": "2024-02-09T20:21:50.467285+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": null,
          "device_class": null,
          "original_device_class": "voltage",
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": "V",
          "state": {
            "entity_id": "sensor.stecker_5_spannung",
            "state": "223.1",
            "attributes": {
              "state_class": "measurement",
              "unit_of_measurement": "V",
              "device_class": "voltage",
              "friendly_name": "Stecker 5 Spannung"
            },
            "last_changed": "2024-02-09T20:21:48.712742+00:00",
            "last_updated": "2024-02-09T20:21:48.712742+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "original_icon": "mdi:account-lock",
          "unit_of_measurement": null,
          "state": {
            "entity_id": "switch.stecker_5_kindersicherung",
            "state": "unavailable",
            "attributes": {
              "restored": true,
              "icon": "mdi:account-lock",
              "friendly_name": "Kindersicherung",
              "supported_features": 0
            },
            "last_changed": "2024-02-09T20:18:18.679102+00:00",
            "last_updated": "2024-02-09T20:18:18.679102+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": null,
          "device_class": null,
          "original_device_class": "energy",
          "icon": null,
          "original_icon": "mdi:chart-histogram",
          "unit_of_measurement": null,
          "state": {
            "entity_id": "sensor.stecker5_energie",
            "state": "24.90",
            "attributes": {
              "state_class": "total",
              "source": "sensor.stecker_5_leistung",
              "unit_of_measurement": "kWh",
              "device_class": "energy",
              "friendly_name": "K\u00fchlschrank Energie"
            },
            "last_changed": "2024-02-09T20:19:27.296135+00:00",
            "last_updated": "2024-02-09T20:19:27.296135+00:00"
          }
        }
      ]
    },
    "set_up": true,
    "support_local": true
  }
}

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 4 months ago

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)

ChoyHsien commented 4 months ago

I'm seeing the same 10x error on power, but also 10x error on voltage. image

b33nn77 commented 4 months ago

For me to.

chill-uk commented 4 months ago

Same here. Bought a new matter plug and the power values are 10x higher in homeassistant. The smart-life app is reporting the correct values.

Saint2000 commented 4 months ago

For me too!

a-steels commented 3 months ago

I'm having the same issue. However, interestingly not with all power plugs, only some I purchased recently.

Not sure if it helps, but those devices are shown differently in the Tuya dashboard, one is shown as "ANTELA Smart Plug", one as "Antela Smart Plug" (note the capital writing in the former case). Also, the device IDs (ie product IDs) in HA are different, "9zynrkxe5tys0rja" (wrong values) vs "bhqkxecq6o5qkc52" (correct values)

MrDidiB commented 2 months ago

Same issue. Power and voltage x10 to high.

Bildschirmfoto 2024-04-08 um 15 34 07