-
Notifications
You must be signed in to change notification settings - Fork 629
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
[Device Support Request] Tuya Zigbee smart energy meter DDS238-2 Zigbee with a new manufacturer variant (_TZE200_bkkmqmyo) #1700
Comments
Hello @mmaccaroni , I assume the new device is the single phase power metter, correct? |
Hi darckly, thanks for your reply. Yes it is the single phase. |
Hi @mmaccaroni Looks like you are doing the right things, If it loaded with using custom quirk, the screen should be like this: |
If I use the quirk I got thus error Logger: homeassistant.config_entries Error setting up entry Sonoff Zigbee 3.0 USB Dong - /dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_9a4120891045ec118fb796fd6f14af06-if00-port0, s/n: 9a4120891045ec118fb796fd6f14af06 - ITead - 10C4:EA60 for zha |
This is the quirk I am loading for that error `"""Tuya Din Power Meter.""" from zhaquirks import Bus, LocalDataCluster TUYA_TOTAL_ENERGY_ATTR = 0x0211 SWITCH_EVENT = "switch_event" class TuyaManufClusterDinPower(TuyaManufClusterAttributes):
class TuyaPowerMeasurement(LocalDataCluster, ElectricalMeasurement):
class TuyaElectricalMeasurement(LocalDataCluster, Metering):
class TuyaPowerMeter(TuyaSwitch):
` |
Hmm, I don't update my instance of HA for several months, so looks like my configuration is not affected. But I see that a lot of dicsussions about this error: home-assistant/core#69494 The possible solutions, as I see from the discussion:
Could you try the solutions from that tread? |
I was not aware, but indeed, some changes were made in April to support ZCLv7 zigpy changes. Not the file attached in the issue #1298 |
@mmaccaroni sometimes it need some time for sensors to appear (or restart HA again), and also connect the load to the power metter, e.g. iron or kettle. |
Ok i will try, in the meantime if you need me for debugging, if needed, I am at full disposal. Thank you again! |
Well, in parallel you can debug your device as desribed here: #1298 (comment) and send me the logs |
zhaquirks.log |
@mmaccaroni Could you send me a link where you ordered this version of power meter? |
@darckly this is the link where I ordered from Aliexpress: |
@mmaccaroni may I ask you to unpair the power meter, enable logging, pair the metter again (with load), turn on/off the device and send me the logs again. |
And do you have any other devices connected via ZHA, like termostat? |
Sure will do, power on and off from zha or manually from the device? |
Please do the both: on and off from ZHA and manually. |
@darckly ok I performed the operations, the log is attached. I don't know if it is good but I enclose every ZHA related events, not only the quirk debug strings.
it is also in the attached log. Events in the log are from the device join process, load attached since the beginning. Let me know if you need anything else and again thanks a lot for your support. |
@mmaccaroni Could you try this slightly modified quirk? At least to test on/off functionality I'm trying to see what changed in other tuya quirks and apply the same changes.. |
@darckly thanks for your reply, loaded the quirk and repaired the device, the switch doe not work, but Idon't get the error message anymore. I attach the log for your reference |
@mmaccaroni unfortunatelly, can't find the way how to implement the support without having this device. I see that on zigbee2mqtt also has an issue with this manufacturing ID : On the outside, there are no differences. This version is not recognised by zigbee2mqtt; apparently it uses another format. (Koenkk/zigbee2mqtt.io@e463498) Maybe someone else from contibutors can support... Also I'll continue to monitor Z2M forum. |
Thanks a lot @darckly really appreciated your support! |
I am on the same situation, I bought this device because it was marked as "supported" on https://zigbee.blakadder.com/Hiking_DDS238-2.html |
Just received the same device. And since I'm here you can guess I also received the unsupported _TZE200_bkkmqmyo version, which was sold as "supported". I can pair it, but no entities are showing up. I was able to load the suggested quirk, and got the same results as described above. |
I have the same device and i managed to work almost everything, except the current reading. Based on Zigbee2mqtt Koenkk/zigbee2mqtt#13767 i need to separate the voltage and current readings from one attribute, but i dont know how. My custom quirks: ts0601_din_power.txt |
Interessing. I tried your quirk and now it indeed shows readings. However: the readings are entirely different than on the screen of the device. The current reading is indeed different, but also the energy summation is 0kWh instead of 51.1kWh. |
Any good news? |
Current reading is works now. I put the some comment about the cluster data in the file. I put the reactive power in the code, but dont show up as sensor. You can download the new version here: ts0601_din_power_v2.zip |
Thanks for your efforts @boszenlaszlo
|
Hello, I have one of these devices and seem to be working on it in parallel. My PR is here: #1878 I have the following configured and displaying correct values in Home Assistant: The switch successfully toggles the Meter, but get the error message as well. @javicalle hopes that the following PR will fix the error message: #1859 With the following attributes correctly mapped but not showing as sensors (These are committed in my PR as I do not believe it is an issue with the quirk):
Has anyone here got the reactive power and energy generated to display under sensors?Update: So I did some digging and it seems the ZHA core does not support all the options under ElelctricalMeasurement or Metering. See here: https://github.com/home-assistant/core/blob/dev/homeassistant/components/zha/sensor.py#L265 Noticed that it does have a provision for apparent_power: https://github.com/home-assistant/core/blob/dev/homeassistant/components/zha/sensor.py#L265 I tried updating reactive power to apparent power mapping to test and it displayed as a sensor: To Do: We will need to raise a PR for ZHA core to add support for the missing sensors. from homeassistant.const import (
...
POWER_VOLT_AMPERE_REACTIVE,
POWER_KILO_VOLT_AMPERE_REACTIVE_HOUR,
...
}
@MULTI_MATCH(channel_names=CHANNEL_ELECTRICAL_MEASUREMENT)
class ElectricalMeasurementReactivePower(ElectricalMeasurement, id_suffix="reactive_power"):
"""Reactive power measurement."""
SENSOR_ATTR = "reactive_power"
_attr_device_class: SensorDeviceClass = SensorDeviceClass.REACTIVE_POWER
_attr_should_poll = False # Poll indirectly by ElectricalMeasurementSensor
_unit = POWER_VOLT_AMPERE_REACTIVE
@MULTI_MATCH(channel_names=CHANNEL_ELECTRICAL_MEASUREMENT)
class ElectricalMeasurementTotalReactivePower(ElectricalMeasurement, id_suffix="total_reactive_power"):
"""Total Reactive Power measurement."""
SENSOR_ATTR = "total_reactive_power"
_attr_device_class: SensorDeviceClass = SensorDeviceClass.REACTIVE_POWER
_attr_should_poll = False # Poll indirectly by ElectricalMeasurementSensor
_unit = POWER_KILO_VOLT_AMPERE_REACTIVE_HOUR
_decimals: 2
def formatter(self, value: int) -> int | float:
"""Return 'normalized' value."""
value = float(value) / 100
if value < 100: # only round tinny values
return round(value, self._decimals)
return round(value)
class SmartEnergyReceivedSummation(SmartEnergyMetering, id_suffix="summation_received"):
"""Smart Energy Metering summation sensor."""
SENSOR_ATTR: int | str = "current_summ_received"
_attr_device_class: SensorDeviceClass = SensorDeviceClass.ENERGY
_attr_state_class: SensorStateClass = SensorStateClass.TOTAL_INCREASING
unit_of_measure_map = {
0x00: ENERGY_KILO_WATT_HOUR,
0x01: VOLUME_CUBIC_METERS,
0x02: VOLUME_CUBIC_FEET,
0x03: f"100 {VOLUME_CUBIC_FEET}",
0x04: f"US {VOLUME_GALLONS}",
0x05: f"IMP {VOLUME_GALLONS}",
0x06: "BTU",
0x07: VOLUME_LITERS,
0x08: "kPa", # gauge
0x09: "kPa", # absolute
0x0A: f"1000 {VOLUME_CUBIC_FEET}",
0x0B: "unitless",
0x0C: "MJ",
}
def formatter(self, value: int) -> int | float:
"""Numeric pass-through formatter."""
if self._channel.unit_of_measurement != 0:
return self._channel.summa_formatter(value)
cooked = float(self._channel.multiplier * value) / self._channel.divisor
return round(cooked, 3) Also add support for the new unit in const.py # Reactive power units
...
POWER_KILO_VOLT_AMPERE_REACTIVE_HOUR: Final = "kVAr" The above should solve our issue - hacked it into my HA directly and seems like it works! Two things I am not sure of:
|
The |
I believe that the So, the The problem is that Maybe you can keep the value as is in the def formatter(self, value: int) -> int | float:
"""Return 'normalized' value."""
value = float(value) / 100
if value < 100: # only round tinny values
return round(value, self._decimals)
return round(value) |
Updated the |
According to the specification the units would be Reference: |
Thanks for picking that up, I just copied what came with the meter instructions. Code snippet above updated. Keen to get this merged into core is there any etiquette or best practices to follow? Or just fork and PR? |
Let see if I can recall all the info. The current device classes in HA are listed here: There is a Usually, any change of types and units will require a architecture discussion.
After that, a couple of discussions have been arise:
The first one (724) talks about the reactive energy and its units So, what now? |
…iguration (#1877)(#1700) (#1878) * TS0601 - _TZE200_bkkmqmyo - Basic Switch Support Added (#1877) * Fixing code style errors and warnings from flake8 (#1877) * Fixing code style errors from black (#1877) * Fixing code style errors from black and flake8 (#1877) * Energy Summation and RMS Voltage Support (#1877) * Adding Power Measurement and Fixing Switch Attribute (#1877) * Fixing code style errors from black (#1877) * Add Support for AC Frequency (#1878) * Fix code style issues identified by flake8 and black (#1878) * Fix code style issues identified by black (#1878) * Add Support for Power Factor (#1878) * Code style fixes - black and flake8 (#1878) * Code style fixes - black (#1878) * Add Support for RMS Current (#1878) * Add Support For Energy Received / Generated (#1878) * Add Support for Reactive Power and Totals (#1878) Note this does not display under sensors for HA * Removing Divide for Total Reactive Power for better resolution(#1878) total_reactive_power is an integer so decimals are rounded during conversion. Moving the formatting to happen at the sensor level.
No possible to change the reporting frequency |
Can someone confirm that #1878 fix that issue? |
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions. |
Hello, Does this quirk works for this: _TZE204_cjbofhxw too? |
Hi, I purchased this device which was markes as working with zha, unfortunatrly I got one with a new manufacturer, and, upon pairing, no entities appear.
This is the signature
Tried to adapt other quirks that were shared in the past with no success
The text was updated successfully, but these errors were encountered: