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 [Yagusmart Metering_3PN_WiFi] and bitmaps #1473

Closed
sudo-nitz opened this issue Dec 31, 2023 · 4 comments
Closed

Request support for [Yagusmart Metering_3PN_WiFi] and bitmaps #1473

sudo-nitz opened this issue Dec 31, 2023 · 4 comments

Comments

@sudo-nitz
Copy link

sudo-nitz commented Dec 31, 2023

Log Message

Ten błąd pochodzi z niestandardowej integracji.

Logger: custom_components.tuya_local.helpers.device_config
Source: custom_components/tuya_local/helpers/device_config.py:981
Integration: tuya_local (documentation, issues)
First occurred: 19:23:06 (1 occurrences)
Last logged: 19:23:06

Parse error in yagusmart_metering_3pn.yaml

Ten błąd pochodzi z niestandardowej integracji.

Logger: custom_components.tuya_local.config_flow
Source: custom_components/tuya_local/config_flow.py:97
Integration: tuya_local (documentation, issues)
First occurred: 19:23:06 (1 occurrences)
Last logged: 19:23:06

Device matches zigbee_zth08ztu_temphumid_sensor with quality of 29%. DPS: {"updated_at": 1704046982.500141, "1": 3364, "2": 0, "9": 0, "11": false, "12": true, "13": 0, "19": "SPM02_237A"}

Ten błąd pochodzi z niestandardowej integracji.

Logger: custom_components.tuya_local.config_flow
Source: custom_components/tuya_local/config_flow.py:103
Integration: tuya_local (documentation, issues)
First occurred: 19:23:06 (1 occurrences)
Last logged: 19:23:06

Report this to https://github.com/make-all/tuya-local/issues/

Information about DPS mappings

Raw data:

{
  "result": {
    "model": "{\"modelId\":\"0000036ouo\",\"services\":[{\"actions\":[],\"code\":\"\",\"description\":\"\",\"events\":[],\"name\":\"默认服务\",\"properties\":
       [{\"abilityId\":1,\"accessMode\":\"ro\",\"code\":\"total_forward_energy\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_lightning\",\"attribute\":\"1152\"},\"name\":\"正向总有功电量\",\"typeSpec\":{\"max\":99999999,\"min\":0,\"scale\":2,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":0,\"unit\":\"kW·h\"}},
       {\"abilityId\":2,\"accessMode\":\"ro\",\"code\":\"cur_neutral\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-power1\",\"attribute\":\"1152\"},\"name\":\"累计反向有功电能\",\"typeSpec\":{\"max\":99999999,\"min\":0,\"scale\":2,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":0,\"unit\":\"kW.h\"}},
       {\"abilityId\":6,\"accessMode\":\"ro\",\"code\":\"phase_a\",\"description\":\"1,A相电压,电流及功率\\n2,大端模式,HEX格式,共8个字节\\n3,单位精度:电压,2字节,单位0.1V。电流,3字节,单位 0.001A 。A相有功功率,3字节,单位0.0001kW\\n4,报文格式\\n举例:08 80 00 03 E8 00 27 10 表示A相217.6V,A相电流1.000A,A相功率10.000KW\\n5,通信逻辑:\\n1)用户进面板,主动查询。用户进入面板,面板马上下发0x08到电表,电表上报数据到云平台,面板拿到数据,然后展示。 注:最新WIFI支持。   \\n2)电表基于一定周期上报数据。建议:在WIFI模式时,15秒上报一次。NB模式时,1个小时上报一次。\",\"extensions\":{\"iconName\":\"icon-dp_lightning\",\"attribute\":\"1152\"},\"name\":\"上报A相电压,电流及功率\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
       {\"abilityId\":7,\"accessMode\":\"ro\",\"code\":\"phase_b\",\"description\":\"1,B相电压,电流及功率\\n2,大端模式,HEX格式,共8个字节\\n3,单位精度:电压,2字节,单位0.1V。电流,3字节,单位 0.001A 。B相有功功率,3字节,单位0.0001kW\\n4,报文格式\\n举例:08 80 00 03 E8 00 27 10 表示B相217.6V,B相电流1.000A,B相功率10.000KW\\n5,通信逻辑:\\n1)用户进面板,主动查询。用户进入面板,面板马上下发0x00到电表,电表上报数据到云平台,面板拿到数据,然后展示。    \\n2)电表基于一定周期上报数据。建议:在WIFI模式时,15秒上报一次。NB模式时,1个小时上报一次。\",\"extensions\":{\"iconName\":\"icon-dp_lightning\",\"attribute\":\"1152\"},\"name\":\"上报B相电压,电流及功率\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
       {\"abilityId\":8,\"accessMode\":\"ro\",\"code\":\"phase_c\",\"description\":\"1,C相电压,电流及功率\\n2,大端模式,HEX格式,共8个字节\\n3,单位精度:电压,2字节,单位0.1V。电流,3字节,单位 0.001A 。C相有功功率,3字节,单位0.0001kW\\n4,报文格式\\n举例:08 80 00 03 E8 00 27 10 表示C相217.6V,C相电流1.000A,C相功率10.000KW\\n5,通信逻辑:\\n1)用户进面板,主动查询。用户进入面板,面板马上下发0x08到电表,电表上报数据到云平台,面板拿到数据,然后展示。    \\n2)电表基于一定周期上报数据。建议:在WIFI模式时,15秒上报一次。NB模式时,1个小时上报一次。\",\"extensions\":{\"iconName\":\"icon-dp_lightning\",\"attribute\":\"1152\"},\"name\":\"上报C相电压,电流及功率\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
       {\"abilityId\":9,\"accessMode\":\"ro\",\"code\":\"fault\",\"description\":\"1,告警\\n2,大端模式,HEX,4字节\\n3,报文格式\\n按照完整4个字节,对应的告警位上报告警;bit位,1表示有告警,0表示无告警;如果没用的告警位,补0。高位无定义,也补0;\\n举例:0X00 00 00 09,表示当前发生了漏电自检不正常告警和短路告警,无其它告警。\\n4,通信逻辑\\n只要有1个告警发生,就完整4个字节上报给面板;只要有1个告警关闭,就完整4个字节上报给面板,更新面板显示。\",\"extensions\":{\"iconName\":\"icon-baojing\",\"attribute\":\"1152\"},\"name\":\"故障上报\",\"typeSpec\":{\"label\":[\"short_circuit_alarm\",\"surge_alarm\",\"overload_alarm\",\"leakagecurr_alarm\",\"temp_dif_fault\",\"fire_alarm\",\"high_power_alarm\",\"self_test_alarm\",\"ov_cr\",\"unbalance_alarm\",\"ov_vol\",\"undervoltage_alarm\",\"miss_phase_alarm\",\"outage_alarm\",\"magnetism_alarm\",\"credit_alarm\",\"no_balance_alarm\"],\"maxlen\":17,\"type\":\"bitmap\",\"typeDefaultValue\":0}},{\"abilityId\":11,\"accessMode\":\"rw\",\"code\":\"switch_prepayment\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_money\",\"attribute\":\"1152\"},\"name\":\"预付费功能开关\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}},
       {\"abilityId\":12,\"accessMode\":\"rw\",\"code\":\"clear_energy\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-Ele\",\"attribute\":\"1152\"},\"name\":\"余额清零\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}},{\"abilityId\":13,\"accessMode\":\"ro\",\"code\":\"balance_energy\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_lightning\",\"attribute\":\"1152\"},\"name\":\"余额\",\"typeSpec\":{\"max\":99999999,\"min\":0,\"scale\":2,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":0,\"unit\":\"kW·h\"}},
       {\"abilityId\":14,\"accessMode\":\"rw\",\"code\":\"charge_energy\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_money\",\"attribute\":\"1152\"},\"name\":\"电量充值\",\"typeSpec\":{\"max\":999999,\"min\":0,\"scale\":2,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":0,\"unit\":\"kW·h\"}},
       {\"abilityId\":17,\"accessMode\":\"rw\",\"code\":\"alarm_set_1\",\"description\":\"1,告警阈值使能控制及设置2  \\n2,HEX格式,大端模式, 总告警的数量*4字节= 设置告警总长度。\\n3,报文格式\\n每个告警由4个字节组成,第1个字节(表示该告警存在);第2个字节(发生此告警时,断路器控制模式(0X01拉闸,0X00不动作只告警);第3、4字节:设置告警阈值\\n举例:0X01 01 00 00 03 01 00 14,表示该断路器支持短路告警,发生该告警时,自动跳闸,阀值补0。支持过载告警,发生该告警时,拉闸动作,动作阀值20KW。无其它告警。\\n4,通信逻辑\\nA,配网成功后,按照上面的格式,主动上报给云平台,面板知道哪些告警是断路器当前支持的。设置不成功,重新配网再上报。\\nB,断路器上电时,也上报一次。\\nC,面板根据协议下发告警设置。\",\"extensions\":{\"iconName\":\"icon-dp_warming\",\"attribute\":\"1152\"},\"name\":\"告警设置1\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
       {\"abilityId\":18,\"accessMode\":\"rw\",\"code\":\"alarm_set_2\",\"description\":\"1,告警阈值使能控制及设置2  \\n2,HEX格式,大端模式\\n3,报文格式\\n每个告警由4个字节组成,第1个字节(表示该告警存在);第2个字节(发生此告警时,断路器控制模式(0X01拉闸,0X00不动作只告警);第3、4字节:设置告警阈值\\n举例:0X01 01 00 3C 03 01 00 F5,表示该断路器支持过流告警,发生该告警时,拉闸动作,动作阀值60A。支持过压告警,发生该告警时,拉闸动作,动作阀值245V\\n4,通信逻辑\\nA,配网成功后,按照上面的格式,主动上报给云平台,面板知道哪些告警是断路器当前支持的。设置不成功,重新配网再上报。\\nB,断路器上电时,也上报一次。\\nC,面板根据协议下发告警设置。\",\"extensions\":{\"iconName\":\"icon-dp_warming\",\"attribute\":\"1152\"},\"name\":\"告警设置2\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
       {\"abilityId\":19,\"accessMode\":\"ro\",\"code\":\"breaker_id\",\"description\":\"1,设备号\\n2,大端模式,字符串型\\n3,单位精度\\n4,报文格式\\n5,通信逻辑\\nA,配网时上报三次,以确保上报成功。如果配对成功,面板有显示设备号。\\nB,如果配对成功,面板没有显示设备号,需要移除设备,再配置一遍。\\nC,每次断路器上电,也上报一次。\",\"extensions\":{\"iconName\":\"icon-dp_mode\",\"attribute\":\"1152\"},\"name\":\"断路器设备号\",\"typeSpec\":{\"maxlen\":255,\"type\":\"string\",\"typeDefaultValue\":\"\"}}]}]}"
  },
  "success": true,
  "t": 1704043987498,
  "tid": "a8f14f8da80211eeb92c1eb6da6ffc4b"
}

Translated from Chinese:

{
   "result": {
     "model": "{\"modelId\":\"0000036ouo\",\"services\":[{\"actions\":[],\"code\":\"\",\"description\ ":\"\",\"events\":[],\"name\":\"Default Service\",\"properties\":
       [{\"abilityId\":1,\"accessMode\" :\"ro\",\"code\":\"total_forward_energy\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_lightning\" ,\"attribute\":\"1152\"},\"name\":\"Forward total active power\",\"typeSpec\":{\"max\":99999999,\"min\" :0,\"scale\":2,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":0,\"unit\":\"kW·h \"}},
       {\"abilityId\":2,\"accessMode\":\"ro\",\"code\":\"cur_neutral\",\"description\":\"\",\ "extensions\":{\"iconName\":\"icon-power1\",\"attribute\":\"1152\"},\"name\":\"Cumulative reverse active energy\",\ "typeSpec\":{\"max\":99999999,\"min\":0,\"scale\":2,\"step\":1,\"type\":\"value\", \"typeDefaultValue\":0,\"unit\":\"kW.h\"}},
       {\"abilityId\":6,\"accessMode\":\"ro\",\"code\" :\"phase_a\",\"description\":\"1, Phase A voltage, current and power\\n2, big-endian mode, HEX format, 8 bytes in total\\n3, unit accuracy: voltage, 2 Byte, unit 0.1V. Current, 3 bytes, unit 0.001A. Phase A active power, 3 bytes, unit 0.0001kW\\n4, message format\\nExample: 08 80 00 03 E8 00 27 10 means phase A 217.6V, phase A current 1.000A, phase A power 10.000KW\ \n5. Communication logic: \\n1) Users enter the panel and actively query. When the user enters the panel, the panel immediately sends 0x08 to the meter. The meter reports the data to the cloud platform. The panel obtains the data and then displays it. Note: The latest WIFI support. \\n2) The electric meter reports data based on a certain period. Suggestion: In WIFI mode, report once every 15 seconds. In NB mode, it is reported once every hour. \",\"extensions\":{\"iconName\":\"icon-dp_lightning\",\"attribute\":\"1152\"},\"name\":\"Report phase A voltage, Current and power\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
       {\"abilityId\":7,\"accessMode\": \"ro\",\"code\":\"phase_b\",\"description\":\"1, B-phase voltage, current and power\\n2, big-endian mode, HEX format, 8 words in total Section\\n3, unit precision: voltage, 2 bytes, unit 0.1V. Current, 3 bytes, unit 0.001A. Phase B active power, 3 bytes, unit 0.0001kW\\n4, message format\\nExample: 08 80 00 03 E8 00 27 10 means phase B 217.6V, phase B current 1.000A, phase B power 10.000KW**\ \n5. Communication logic: \\n1) Users enter the panel and actively query. When the user enters the panel, the panel immediately sends 0x00 to the meter. The meter reports the data to the cloud platform. The panel obtains the data and then displays it. \\n2) The electric meter reports data based on a certain period. Suggestion: In WIFI mode, report once every 15 seconds. In NB mode, it is reported once every hour. \",\"extensions\":{\"iconName\":\"icon-dp_lightning\",\"attribute\":\"1152\"},\"name\":\"Report phase B voltage, Current and power\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
       {\"abilityId\":8,\"accessMode\": \"ro\",\"code\":\"phase_c\",\"description\":\"1, C-phase voltage, current and power\\n2, big-endian mode, HEX format, 8 words in total Section\\n3, unit precision: voltage, 2 bytes, unit 0.1V. Current, 3 bytes, unit 0.001A. C-phase active power, 3 bytes, unit 0.0001kW\\n4, message format\\nExample: 08 80 00 03 E8 00 27 10 means C-phase 217.6V, C-phase current 1.000A, C-phase power 10.000KW\ \n5. Communication logic: \\n1) Users enter the panel and actively query. When the user enters the panel, the panel immediately sends 0x08 to the meter. The meter reports the data to the cloud platform. The panel obtains the data and then displays it. \\n2) The electric meter reports data based on a certain period. Suggestion: In WIFI mode, report once every 15 seconds. In NB mode, it is reported once every hour. \",\"extensions\":{\"iconName\":\"icon-dp_lightning\",\"attribute\":\"1152\"},\"name\":\"Report phase C voltage, Current and power\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
       {\"abilityId\":9,\"accessMode\": \"ro\",\"code\":\"fault\",\"description\":\"1, alarm\\n2, big endian mode, HEX, 4 bytes\\n3, message format\ \nAccording to the complete 4 bytes, the corresponding alarm bit is reported; bit bit, 1 means there is an alarm, 0 means no alarm; if the alarm bit is useless, fill it with 0. The high bit is not defined and is also filled with 0; \\nExample: 0X00 00 00 09, indicating that an abnormal leakage self-test alarm and a short circuit alarm are currently occurring, and there are no other alarms. \\n4. Communication logic\\nAs long as an alarm occurs, 4 bytes will be reported to the panel; as long as an alarm is closed, 4 bytes will be reported to the panel and the panel display will be updated. \",\"extensions\":{\"iconName\":\"icon-baojing\",\"attribute\":\"1152\"},\"name\":\"Fault Report\", \"typeSpec\":{\"label\":[\"short_circuit_alarm\",\"surge_alarm\",\"overload_alarm\",\"leakagecurr_alarm\",\"temp_dif_fault\",\"fire_alarm\", \"high_power_alarm\",\"self_test_alarm\",\"ov_cr\",\"unbalance_alarm\",\"ov_vol\",\"undervoltage_alarm\",\"miss_phase_alarm\",\"outage_alarm\",\" magnetism_alarm\",\"credit_alarm\",\"no_balance_alarm\"],\"maxlen\":17,\"type\":\"bitmap\",\"typeDefaultValue\":0}},
       {\"abilityId\":11,\"accessMode\":\"rw\",\"code\":\"switch_prepayment\",\"description\":\"\",\"extensions\":{\" iconName\":\"icon-dp_money\",\"attribute\":\"1152\"},\"name\":\"Prepaid function switch\",\"typeSpec\":{\"type \":\"bool\",\"typeDefaultValue\":false}},
       {\"abilityId\":12,\"accessMode\":\"rw\",\"code\":\"clear_energy\ ",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-Ele\",\"attribute\":\"1152\"},\"name \":\"Balance reset\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}},
       {\"abilityId\":13,\ "accessMode\":\"ro\",\"code\":\"balance_energy\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon -dp_lightning\",\"attribute\":\"1152\"},\"name\":\"balance\",\"typeSpec\":{\"max\":99999999,\"min\" :0,\"scale\":2,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":0,\"unit\":\"kW·h \"}},
       {\"abilityId\":14,\"accessMode\":\"rw\",\"code\":\"charge_energy\",\"description\":\"\",\ "extensions\":{\"iconName\":\"icon-dp_money\",\"attribute\":\"1152\"},\"name\":\"Power Recharge\",\"typeSpec\ ":{\"max\":999999,\"min\":0,\"scale\":2,\"step\":1,\"type\":\"value\",\"typeDefaultValue \":0,\"unit\":\"kW·h\"}},
       {\"abilityId\":17,\"accessMode\":\"rw\",\"code\":\" alarm_set_1\",\"description\":\"1, alarm threshold enable control and setting 2 \\n2, HEX format, big endian mode, the number of total alarms * 4 bytes = set the total length of the alarm. \\n3, message format\\nEach alarm consists of 4 bytes, the first byte (indicates that the alarm exists); the second byte (when this alarm occurs, the circuit breaker control mode (0X01 pull gate, 0X00 does not act but only alarms); 3rd and 4th bytes: set the alarm threshold\\nExample: 0X01 01 00 00 03 01 00 14, indicating that the circuit breaker supports short circuit alarm. When this alarm occurs, it will automatically trip and the valve The value is filled with 0. It supports overload alarm. When this alarm occurs, the gate action is taken, and the action threshold is 20KW. There are no other alarms.\\n4. Communication logic\\nA. After the network configuration is successful, it will be actively reported to the cloud according to the above format. Platform, the panel knows which alarms are currently supported by the circuit breaker. If the setting is unsuccessful, re-configure the network and report again.\\nB. When the circuit breaker is powered on, it is also reported once.\\nC. The panel issues the alarm settings according to the protocol.\ ",\"extensions\":{\"iconName\":\"icon-dp_warming\",\"attribute\":\"1152\"},\"name\":\"Alarm Settings 1\", \"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
       {\"abilityId\":18,\"accessMode\":\"rw\",\"code\":\"alarm_set_2\",\"description\":\"1, alarm threshold enable control and setting 2 \\n2, HEX format, big endian mode\\n3, message format\\nEach alarm consists of 4 bytes, the 1st byte (indicates that the alarm exists); the 2nd byte (occurrence When this alarm occurs, the circuit breaker control mode (0X01 switches on, 0X00 does not operate but only alarms); the 3rd and 4th bytes: set the alarm threshold\\nExample: 0X01 01 00 3C 03 01 00 F5, indicating that the circuit breaker supports Flow alarm, when this alarm occurs, the gate action is taken, the action threshold is 60A. It supports overvoltage alarm, when this alarm occurs, the gate action is taken, the action threshold is 245V\\n4, communication logic\\nA, after the network distribution is successful, According to the above format, proactively report to the cloud platform, and the panel will know which alarms are currently supported by the circuit breaker. If the setting is unsuccessful, re-configure the network and report again.\\nB, When the circuit breaker is powered on, it will also be reported once.\\nC, The panel issues alarm settings according to the protocol.\",\"extensions\":{\"iconName\":\"icon-dp_warming\",\"attribute\":\"1152\"},\"name\" :\"Alarm Settings 2\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
       {\"abilityId\":19,\"accessMode \":\"ro\",\"code\":\"breaker_id\",\"description\":\"1, device number\\n2, big endian mode, string type\\n3, unit precision \\n4, message format\\n5, communication logic\\nA, report three times during network configuration to ensure successful reporting. If the pairing is successful, the panel will display the device number.\\nB, if the pairing is successful, the panel will not display the device No., you need to remove the device and configure it again.\\nC, it is also reported every time the circuit breaker is powered on.\",\"extensions\":{\"iconName\":\"icon-dp_mode\", \"attribute\":\"1152\"},\"name\":\"Circuit breaker equipment number\",\"typeSpec\":{\"maxlen\":255,\"type\":\ "string\",\"typeDefaultValue\":\"\"}}]}]}"
   },
   "success": true,
   "t": 1704043987498,
   "tid": "a8f14f8da80211eeb92c1eb6da6ffc4b"
}

Also Query properties from API explorer:

{
  "result": {
    "properties": [
      {
        "code": "total_forward_energy",
        "custom_name": "",
        "dp_id": 1,
        "time": 1704045186093,
        "value": 3296
      },
      {
        "code": "cur_neutral",
        "custom_name": "",
        "dp_id": 2,
        "time": 1701553948190,
        "value": 0
      },
      {
        "code": "phase_a",
        "custom_name": "",
        "dp_id": 6,
        "time": 1704045343994,
        "value": "CWkAARgAACo="
      },
      {
        "code": "phase_b",
        "custom_name": "",
        "dp_id": 7,
        "time": 1704045344200,
        "value": "CYYAAlsAAD8="
      },
      {
        "code": "phase_c",
        "custom_name": "",
        "dp_id": 8,
        "time": 1704045344314,
        "value": "CYoAAbkAACg="
      },
      {
        "code": "fault",
        "custom_name": "",
        "dp_id": 9,
        "time": 1704042313687,
        "value": 0
      },
      {
        "code": "switch_prepayment",
        "custom_name": "",
        "dp_id": 11,
        "time": 1701553948190,
        "value": false
      },
      {
        "code": "clear_energy",
        "custom_name": "",
        "dp_id": 12,
        "time": 1703287326207,
        "value": true
      },
      {
        "code": "balance_energy",
        "custom_name": "",
        "dp_id": 13,
        "time": 1701553948190,
        "value": 0
      },
      {
        "code": "charge_energy",
        "custom_name": "",
        "dp_id": 14,
        "time": 1693165538022,
        "value": 53500
      },
      {
        "code": "alarm_set_1",
        "custom_name": "",
        "dp_id": 17,
        "time": 1703585858888,
        "value": "BwEADQgBAAA="
      },
      {
        "code": "alarm_set_2",
        "custom_name": "",
        "dp_id": 18,
        "time": 1703585858990,
        "value": "AQEAPAIBAA8DAQD9BAAAtAUBAAAHAQAACAAAHgkAAAA="
      },
      {
        "code": "breaker_id",
        "custom_name": "",
        "dp_id": 19,
        "time": 1701553948190,
        "value": "SPM02_237A"
      }
    ]
  },
  "success": true,
  "t": 1704045348479,
  "tid": "d43efbe7a80511ee9e170225947fc7de"
}

Product Info

Product ID:
fygozcnralhwbauo

Product description:
Yagusmart Energy metering device for 3 phases (https://aliexpress.com/item/1005006035378901.html)

Issue

I've prepared basic configuration file:

name: Yagusmart energy 3PN 63A metering device
products:
  - id: fygozcnralhwbauo
    name: Yagusmart energy 3PN 63A metering device
primary_entity:
  - entity: sensor
    category: diagnostic
    name: Total forward energy
    class: energy
    dps:
      - id: 1
        name: sensor
        type: integer
        unit: kWh
        class: total_increasing
        mapping:
          - scale: 100
  - entity: sensor
    category: diagnostic
    name: Total reverse energy
    class: energy
    dps:
      - id: 2
        name: sensor
        type: integer
        unit: kWh
        class: total_increasing
        mapping:
          - scale: 100
  - entity: sensor
    category: diagnostic
    name: Balance
    class: energy
    dps:
      - id: 13
        name: sensor
        type: integer
        unit: kWh
        class: measurement
        mapping:
          - scale: 100
secondary_entity:
  - entity: sensor
    category: diagnostic
    name: phase A
    dps:
      - id: 6
        name: sensor
        type: base64
        class: measurement
  - entity: sensor
    category: diagnostic
    name: phase B
    dps:
      - id: 7
        name: sensor
        type: base64
        class: measurement
  - entity: sensor
    category: diagnostic
    name: phase C
    dps:
      - id: 8
        name: sensor
        type: base64
        class: measurement
  - entity: sensor
    category: diagnostic
    name: Fault
    dps:
      - id: 9
        name: sensor
        type: bitfield
  - entity: sensor
    category: diagnostic
    name: Fault
    dps:
      - id: 17
        name: sensor
        type: base64
  - entity: sensor
    category: diagnostic
    name: Fault
    dps:
      - id: 18
        name: sensor
        type: base64
  - entity: sensor
    category: diagnostic
    name: Breaker ID
    dps:
      - id: 19
        name: sensor
        type: string
  - entity: switch
    category: config
    name: Switch prepayment
    dps:
      - id: 11
        name: switch
        type: boolean
  - entity: select
    category: config
    name: Reset energy
    dps:
      - id: 12
        name: switch
        type: boolean
  - entity: number
    category: config
    name: Charge energy
    class: energy
    dps:
      - id: 14
        name: number
        type: integer
        unit: kWh
        mapping:
          - scale: 100
        range:
          - min: 0
          - max: 999999

I have problems with decoding phases and faults.

For example:

  - entity: sensor
    category: diagnostic
    name: phase A
    dps:
      - id: 6
        name: sensor
        type: base64
        class: measurement

As You can see in DPS a phase data consists of voltage, current and power (big-endian mode, HEX format, 8 bytes in total). Unit accuracy: voltage 2 bytes with unit 0.1V; current 3 bytes with unit 0.001A; active power 3 bytes with unit 0.0001kW. Example message 08 80 00 03 E8 00 27 10 means 217.6V, current 1.000A and power 10.000KW.

Can be decoded like below?

  - entity: sensor
    category: diagnostic
    class: voltage
    name: Voltage (phase A)
    dps:
      - id: 6
        name: sensor
        type: base64
        mask: FF000000
        unit: V        
        mapping:
          - scale: 10
        class: measurement
  - entity: sensor
    category: diagnostic
    class: current
    name: Current (phase A)
    dps:
      - id: 6
        name: sensor
        type: base64
        mask: 00FFF000
        unit: A        
        mapping:
          - scale: 100
        class: measurement
  - entity: sensor
    category: diagnostic
    class: voltage
    name: Power (phase A)
    dps:
      - id: 6
        name: sensor
        type: base64
        mask: 00000FFF
        unit: kW        
        mapping:
          - scale: 1000
        class: measurement

Is that correct?

@sudo-nitz sudo-nitz added the new device Unsupported device label Dec 31, 2023
@sudo-nitz sudo-nitz changed the title Request support for [Yagusmart Metering_3PN_WiFi] Request support for [Yagusmart Metering_3PN_WiFi] and bitmaps Jan 1, 2024
@make-all
Copy link
Owner

make-all commented Jan 1, 2024

Your mask needs twice as many characters, but from the log there is also a parse error in that yaml (more details should be in the Full Log)

@make-all make-all added the full_info All info needed was provided label Jan 1, 2024
@sudo-nitz
Copy link
Author

sudo-nitz commented Jan 1, 2024

Last readings from system log:

2024-01-01 15:08:49.906 ERROR (MainThread) [custom_components.tuya_local.helpers.device_config] Parse error in yagusmart_metering_3pn.yaml
2024-01-01 15:08:50.130 WARNING (MainThread) [custom_components.tuya_local.config_flow] Device matches zigbee_zth08ztu_temphumid_sensor with quality of 29%. DPS: {"updated_at": 1704118124.6304154, "1": 3634, "2": 0, "9": 0, "11": false, "12": true, "13": 0, "19": "SPM02_237A"}
2024-01-01 15:08:50.130 WARNING (MainThread) [custom_components.tuya_local.config_flow] Report this to https://github.com/make-all/tuya-local/issues/

Is there different way to check another logs related with Tuya-Local?


  - entity: sensor
    category: diagnostic
    class: voltage
    name: Voltage (phase A)
    dps:
      - id: 6
        name: sensor
        type: base64
        mask: FFFF000000000000
        unit: V        
        mapping:
          - scale: 10
        class: measurement
  - entity: sensor
    category: diagnostic
    class: current
    name: Current (phase A)
    dps:
      - id: 6
        name: sensor
        type: base64
        mask: 0000FFFFFF000000
        unit: A        
        mapping:
          - scale: 100
        class: measurement
  - entity: sensor
    category: diagnostic
    class: voltage
    name: Power (phase A)
    dps:
      - id: 6
        name: sensor
        type: base64
        mask: 0000000000FFFFFF
        unit: kW        
        mapping:
          - scale: 1000
        class: measurement

I hope now it's okay. Today's evening I will try to decode faults.

@make-all
Copy link
Owner

The parse error should have more details if you expand it, or look into the Full Logs.

It would be useful to capture a sample of one of the dps 6, 7 or 8. Such combined dps have usually been base64 encoded in our experience, but the documentation specifically mentions HEX. But this is not causing the parse error in the yaml, it is most likely indentation or a missing or extra colon or dash.

@make-all
Copy link
Owner

I see an issue (but I am not sure that it would cause a general yaml parse error). The primary_entity should be just one entity, not a list. Since it is not a list, it should not start with a dash.
The other entities under primary_entity should be moved under secondary_entities. There is no distinction really, so it won't matter which entity is "primary". It was just a decision I made at the start that turned out to be irrelevant.

make-all added a commit that referenced this issue Jan 22, 2024
@make-all make-all added awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release and removed full_info All info needed was provided new device Unsupported device awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release labels Jan 22, 2024
timlaing pushed a commit to timlaing/tuya-local that referenced this issue Aug 8, 2024
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

2 participants