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

TS011F Plug RMS-Current wrong value #1108

Closed
miit86 opened this issue Oct 28, 2021 · 10 comments
Closed

TS011F Plug RMS-Current wrong value #1108

miit86 opened this issue Oct 28, 2021 · 10 comments

Comments

@miit86
Copy link
Contributor

miit86 commented Oct 28, 2021

Is your feature request related to a problem? Please describe.

This looks OK, a bit off but cheap plugs.

electrical_measurement
193 W
electrical_measurement rms_current
1,141 A

This is not OK.

Electrical_measurement
62 W
Electrical_measurement rms_current
433 A

Describe the solution you'd like
Divide RMS-Current by 1000 (I Guess)

**Device signature - this can be acquired by removing the device from ZHA and pairing it again from the add devices screen.
Signature is OKE

Additional context
Can't find any Attributes for RMS-Current Divide
But Maybe this is not the way to go.

@PlusPlus-ua
Copy link
Contributor

Hi,

I've just updated to Home Assistant Core version core-2021.11.0b0 and zha-device-handlers version 0.0.63. Mine version of the device is TS011F _TZ3000_cphmq0q7.

I can see rms_voltage and rms_current in Home Assistant interface. But reported values are wrong. Voltage is constantly 0.2V when real voltage is around 220V. Current with 6-8W load shows 62A.

By the way, is someone managed to change value of an attribute power_on_state (id: 0x8002) of TuyaZBOnOffRestorePowerCluster via Home Assistant interface?

@miit86
Copy link
Contributor Author

miit86 commented Oct 28, 2021

Hi,

For the RMS Voltage is a #1107
For the RMS Current is this Issue

Yes you can change the attribute power_on_state.

  • manage cluster
  • TuyaZBOnOffRestorePowerCluster (Endpoint id: 1, Id: 0x0006, Type: in)
  • power_on_state (id: 0x8002)
  • get Value
  • change Value field to 0,1 or 2
  • Set Value

0 = off
1 = on
2 = last state

@PlusPlus-ua
Copy link
Contributor

According to this document http://documentation.bosch-si.com/iot/SDK/v8.1/SDK_mBS_SmartHome/modules/zigbee/api/driver/constant-values.html

AC_VOLTAGE_MULTIPLIER == 1536 (0x600)
AC_VOLTAGE_DIVISOR == 1537 (0x601)
AC_CURRENT_MULTIPLIER == 1538 (0x602)
AC_CURRENT_DIVISOR == 1539 (0x603)

About power_on_state, I've done it in a wrong way, it works now.

@miit86
Copy link
Contributor Author

miit86 commented Oct 28, 2021

I think I fucked up/mixed Voltage and Current.

Let me check with a custom quirk what happens when I do this:

Remove

class TuyaZBElectricalMeasurement(CustomCluster, ElectricalMeasurement):
    ​"""Divides the Voltage for tuya."""

   ​AC_VOLTAGE_MULTIPLIER = 0x0600
   ​AC_VOLTAGE_DIVISOR = 0x0601
   ​_CONSTANT_ATTRIBUTES = {AC_VOLTAGE_MULTIPLIER: 1, AC_VOLTAGE_DIVISOR: 1000}

ADD

class TuyaZBElectricalMeasurement(CustomCluster, ElectricalMeasurement):
    """Divides the Current for tuya."""
	
   ​AC_CURRENT_MULTIPLIER = 0x0602
   ​AC_CURRENT_DIVISOR = 0x0603
   ​_CONSTANT_ATTRIBUTES = {AC_CURRENT_MULTIPLIER: 1, AC_CURRENT_DIVISOR: 1000}	

@MattWestb
Copy link
Contributor

MattWestb commented Oct 28, 2021

All supported attributes for the class:
class ElectricalMeasurement(Cluster):

https://github.com/zigpy/zigpy/blob/0b2bb5ce76573cb2062e2d31b60a25fa5549ba12/zigpy/zcl/clusters/homeautomation.py#L79

@miit86
Copy link
Contributor Author

miit86 commented Oct 28, 2021

@PlusPlus-ua
image
it's working now
Gonna change my PR

@miit86
Copy link
Contributor Author

miit86 commented Oct 28, 2021

Gonna Close this: fixed with PR #1107

@miit86 miit86 closed this as completed Oct 28, 2021
@MattWestb
Copy link
Contributor

MattWestb commented Oct 28, 2021

If you is putting in " Fixes #1108 " in the PR, then its automatically closing the linked issue then the PR is being merged.

Well done !!

@PonyOny
Copy link

PonyOny commented Feb 10, 2022

@miit86
This is still reporting invalid values with latest HAS (2022.2.5) Current & Voltage
image

Current:
image

Voltage:
image

@dentra
Copy link

dentra commented Feb 14, 2022

Same here but for TZ3000_gjnozsaz.

copy and paste ts011f_plug.py to cusom_zha_quirks and modify to

AC_CURRENT_MULTIPLIER = 0x0602
AC_CURRENT_DIVISOR = 0x0603
AC_VOLTAGE_MULTIPLIER = 0x0600
AC_VOLTAGE_DIVISOR = 0x0601
_CONSTANT_ATTRIBUTES = {AC_CURRENT_MULTIPLIER: 1, AC_CURRENT_DIVISOR: 1000, AC_VOLTAGE_MULTIPLIER: 1, AC_VOLTAGE_DIVISOR: 1}

solves the problem

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

No branches or pull requests

5 participants