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

Request support for WDYK 3 Phase 4 pole 400V circuit breaker with Energy Monitoring #550

Closed
Muelner opened this issue Mar 17, 2023 · 10 comments

Comments

@Muelner
Copy link

Muelner commented Mar 17, 2023

Hi,

It would be greatly appreciated if you can please please pleaseadd device support for WDYK 3 phase 4 pole Circuit breaker with Energy Monitoring:

All Tuya DPs
Name DP_ID
Switch 1 1
Voltage 101
Relay Status 38
Current 102
Active Power 103
Child Lock 40
Leakage Current 106
Countdown 1 9
Temperature 105
Remaining Energty 107
Recharge Energy 108
Cost Parameters 109
Leakage Parameters 110
Voltage Threshold 111
Current Threshold 112
Temperature Threshold 113
Active Energy 114
Equipment Number 115
Clear Energy 116
Locking 117
????? 118 kWh
Historical Voltage 119
Historical Current 120
Fault 26

Tuya IOT Device Stats:
{
"result": {
"category": "cz",
"functions": [
{
"code": "switch_1",
"dp_id": 1,
"type": "Boolean",
"values": "{}"
},
{
"code": "countdown_1",
"dp_id": 9,
"type": "Integer",
"values": "{"unit":"s","min":0,"max":86400,"scale":0,"step":1}"
},
{
"code": "relay_status",
"dp_id": 38,
"type": "Enum",
"values": "{"range":["power_off","power_on","last"]}"
},
{
"code": "child_lock",
"dp_id": 40,
"type": "Boolean",
"values": "{}"
}
],
"status": [
{
"code": "switch_1",
"dp_id": 1,
"type": "Boolean",
"values": "{}"
},
{
"code": "countdown_1",
"dp_id": 9,
"type": "Integer",
"values": "{"unit":"s","min":0,"max":86400,"scale":0,"step":1}"
},
{
"code": "relay_status",
"dp_id": 38,
"type": "Enum",
"values": "{"range":["power_off","power_on","last"]}"
},
{
"code": "child_lock",
"dp_id": 40,
"type": "Boolean",
"values": "{}"
}
]
},
"success": true,
"t": 1679086586001,
"tid": "2e88838bc50611edacf08ac5d669b858"

HomeAssistant Device Logs:

"custom_components": {
"localtuya": {
"version": "5.0.0",
"requirements": []
},
"tuya_local": {
"version": "2022.3.0",
"requirements": [
"pycryptodome~=3.17",
"tinytuya==1.11.0"
]
},
"hacs": {
"version": "1.31.0",
"requirements": [
"aiogithubapi>=22.10.1"
]
}
},
"integration_manifest": {
"domain": "tuya_local",
"name": "Tuya Local",
"codeowners": [
"@make-all"
],
"config_flow": true,
"dependencies": [],
"documentation": "https://github.com/make-all/tuya-local",
"integration_type": "device",
"iot_class": "local_push",
"issue_tracker": "https://github.com/make-all/tuya-local/issues",
"requirements": [
"pycryptodome~=3.17",
"tinytuya==1.11.0"
],
"version": "2022.3.0",
"is_built_in": false
},
"data": {
"name": "Main",
"type": "simple_switch_timerv2",
"device_id": "REDACTED",
"local_key": "REDACTED",
"host": "REDACTED",
"protocol_version": 3.3,
"api_version_set": 3.3,
"api_version_used": 3.3,
"api_working": true,
"status": {},
"cached_state": {
"updated_at": 1679087025.450826,
"1": true,
"9": 0,
"26": 0,
"38": "2",
"40": false,
"104": 7,
"105": 38,
"107": 0,
"114": 876221,
"115": "400100000001 ",
"117": false,
"118": 0,
"101": "CQEJBglW",
"102": "AAAAAAr5AAjO",
"103": "ACWyAAAAABfOAA3j",
"119": "CQwJGQks",
"120": "AAAAAAsjAAo9"
},
"pending_state": {},
"connected": true,
"force_dps": [],
"home_assistant": {
"name": "Main",
"name_by_user": null,
"disabled": false,
"disabled_by": null,
"entities": [
{
"disabled": false,
"disabled_by": null,
"entity_category": "config",
"device_class": null,
"original_device_class": null,
"icon": null,
"unit_of_measurement": null,
"state": {
"entity_id": "select.main_power_on_state",
"state": "unknown",
"attributes": {
"options": [
"On",
"Last state",
"Off"
],
"icon": "mdi:toggle-switch",
"friendly_name": "Main Power on state"
},
"last_changed": "2023-03-17T20:33:32.959496+00:00",
"last_updated": "2023-03-17T20:33:32.959496+00:00"
}
},
{
"disabled": false,
"disabled_by": null,
"entity_category": null,
"device_class": null,
"original_device_class": "outlet",
"icon": null,
"unit_of_measurement": null,
"state": {
"entity_id": "switch.main",
"state": "on",
"attributes": {
"device_class": "outlet",
"friendly_name": "Main"
},
"last_changed": "2023-03-17T21:03:17.820338+00:00",
"last_updated": "2023-03-17T21:03:17.820338+00:00"
}
},
{
"disabled": false,
"disabled_by": null,
"entity_category": "config",
"device_class": null,
"original_device_class": null,
"icon": null,
"unit_of_measurement": "min",
"state": {
"entity_id": "number.main_timer",
"state": "0.0",
"attributes": {
"min": 0.0,
"max": 1440.0,
"step": 1.0,
"mode": "auto",
"unit_of_measurement": "min",
"icon": "mdi:timer",
"friendly_name": "Main Timer"
},
"last_changed": "2023-03-17T20:33:32.959916+00:00",
"last_updated": "2023-03-17T20:33:32.959916+00:00"
}
}
]
}
}
}

Many thanks in advance!

@Muelner Muelner added the new device Unsupported device label Mar 17, 2023
@make-all make-all added awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release labels Apr 22, 2023
@make-all make-all removed new device Unsupported device awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release labels Apr 29, 2023
@ve1koz111
Copy link

ve1koz111 commented Oct 8, 2023

Hey Mate, I have a device which I believe has the same datapoints. How do I force the integration to use this setup on my device?

@make-all
@felipejfc

@make-all
Copy link
Owner

make-all commented Oct 8, 2023

If the datapoints seem to match based on the iot.tuya.com documentation, but it is not detected as this device, then most likely some datapoints are missing from what the device is actually reporting, and need to be made optional in the config.
The HA log should have a message when you attempted to add it, listing the dps that were seen at the time. It is possible that this is mode dependent, so a further attempt to add it may work.

@ve1koz111
Copy link

ve1koz111 commented Oct 8, 2023

@make-all Can you help me with that? It is also a 3-phase monitor of energy. Here's the error:

2023-10-08 12:56:29.392 WARNING (MainThread) [custom_components.tuya_local.config_flow] Device matches simple_switch_timerv2 with quality of 25%. DPS: {"updated_at": 1696751788.3610804, "1": false, "9": 0, "26": 0, "38": "2", "40": false, "104": 0, "105": 42, "107": 0, "114": 141, "115": "400100000022 ", "117": false, "118": 0}
2023-10-08 12:56:29.392 WARNING (MainThread) [custom_components.tuya_local.config_flow] Report this to https://github.com/make-all/tuya-local/issues/

These are the datapoints from the tuya API

{
"result": {
"properties": [
{
"code": "switch_1",
"custom_name": "",
"dp_id": 1,
"time": 1696660467721,
"value": true
},
{
"code": "countdown_1",
"custom_name": "",
"dp_id": 9,
"time": 1696659921938,
"value": 0
},
{
"code": "fault",
"custom_name": "",
"dp_id": 26,
"time": 1696659923094,
"value": 0
},
{
"code": "relay_status",
"custom_name": "",
"dp_id": 38,
"time": 1696659923094,
"value": "2"
},
{
"code": "child_lock",
"custom_name": "",
"dp_id": 40,
"time": 1696659923094,
"value": false
},
{
"code": "Voltage",
"custom_name": "",
"dp_id": 101,
"time": 1696663776773,
"value": "CXUJcwl0"
},
{
"code": "Current",
"custom_name": "",
"dp_id": 102,
"time": 1696663776955,
"value": "AAH6AAIVAAAA"
},
{
"code": "ActivePower",
"custom_name": "",
"dp_id": 103,
"time": 1696663777160,
"value": "AAnTAATLAAUIAAAA"
},
{
"code": "LeakageCurrent",
"custom_name": "",
"dp_id": 104,
"time": 1696663507321,
"value": 6
},
{
"code": "Temperature",
"custom_name": "",
"dp_id": 105,
"time": 1696662156096,
"value": 40
},
{
"code": "RemainingEnergy",
"custom_name": "",
"dp_id": 107,
"time": 1696659923333,
"value": 0
},
{
"code": "RechargeEnergy",
"custom_name": "",
"dp_id": 108,
"time": 1681121928602,
"value": 0
},
{
"code": "CostParameters",
"custom_name": "",
"dp_id": 109,
"time": 1696662322049,
"value": "FLQA"
},
{
"code": "LeakageParameters",
"custom_name": "",
"dp_id": 110,
"time": 1696662337070,
"value": "AQAAABkAAAA="
},
{
"code": "VoltageThreshold",
"custom_name": "",
"dp_id": 111,
"time": 1696662352094,
"value": "CyIAAAH0AAA="
},
{
"code": "CurrentThreshold",
"custom_name": "",
"dp_id": 112,
"time": 1696662367064,
"value": "AYagAAA="
},
{
"code": "TemperatureThreshold",
"custom_name": "",
"dp_id": 113,
"time": 1696662382086,
"value": "ZAAA"
},
{
"code": "KWH",
"custom_name": "",
"dp_id": 114,
"time": 1696663703114,
"value": 36
},
{
"code": "NumberAndType",
"custom_name": "",
"dp_id": 115,
"time": 1696659925132,
"value": "400100000022 "
},
{
"code": "ClearEnergy",
"custom_name": "",
"dp_id": 116,
"time": 1681121928602,
"value": false
},
{
"code": "locking",
"custom_name": "",
"dp_id": 117,
"time": 1696659924734,
"value": false
},
{
"code": "RKWH",
"custom_name": "",
"dp_id": 118,
"time": 1696659925136,
"value": 0
},
{
"code": "VRecording",
"custom_name": "",
"dp_id": 119,
"time": 1696662001498,
"value": "CWwJawls"
},
{
"code": "IRecording",
"custom_name": "",
"dp_id": 120,
"time": 1696662001676,
"value": "AAH5AAIUAAAA"
}
]
},
"success": true,
"t": 1696663787492,
"tid": ""
}

make-all added a commit that referenced this issue Oct 8, 2023
Sensors seem to be missing from the data, assume these need to be force polled,
and mark them as optional so the config matches.

Identified the unknown dps, though meaning of RKWH unclear (reverse energy?)

Issue #550
@make-all
Copy link
Owner

make-all commented Oct 8, 2023

It seems the current, voltage and power readings are not being included in the local data.

@ve1koz111
Copy link

@make-all

Does that mean that it won't report the voltage, current, and power readings? I could using the datapoints manually extract 1 of the voltages/amps and power but was unsure how I could get that from the other phases.

Also, how can I test that committ?

Thank you so much for your help & fast response!

@make-all
Copy link
Owner

make-all commented Oct 8, 2023

If you use HACS, you can test the commit by going into HACS and opening the tuya-local details, then from the top right menu select "Redownload". This should give you a menu where you can select the version to download, and if you select "main", it will download the latest from git. You seem to need to wait until that select box becomes active again after selecting an option before pressing the Download button, otherwise it downloads the default (latest release) instead.

@make-all make-all reopened this Oct 8, 2023
@make-all make-all added awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release device improvement Improvement to an existing device config labels Oct 8, 2023
@ve1koz111
Copy link

ve1koz111 commented Oct 8, 2023

@make-all Works a charm! Appreciate it buddy!

I had an issue with starting the config flow. It gave me an error. When I closed and tried to add the integration again it worked though, not sure if that's related.

@make-all
Copy link
Owner

make-all commented Oct 8, 2023

If you have not since restarted Home Assistant, "an error" should be in the log.

@ve1koz111
Copy link

2023-10-08 13:44:39.856 ERROR (SyncWorker_3) [homeassistant.util.json] Could not parse JSON content: /config/custom_components/tuya_local/translations/en.json
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/util/json.py", line 68, in load_json
return orjson.loads(fdesc.read()) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^

@make-all
Copy link
Owner

make-all commented Oct 8, 2023

Thanks, this was due to a recent change, an extra comma in the file.

@make-all make-all removed awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release device improvement Improvement to an existing device config labels Oct 16, 2023
make-all added a commit that referenced this issue Aug 16, 2024
Issue #2214

Although the model quoted is not identical, there was a lack
of info on the original report #550, so this is likely to be
correct for the original device also.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants