Skip to content

Commit

Permalink
DDF for Tuya bidirectional energy meter (_TZE204_ac0fhfiq) (#7204)
Browse files Browse the repository at this point in the history
  • Loading branch information
Smanar authored Dec 18, 2023
1 parent 7c8dc2e commit 92e8c4e
Show file tree
Hide file tree
Showing 2 changed files with 196 additions and 0 deletions.
6 changes: 6 additions & 0 deletions device_access_fn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,12 @@ bool parseTuyaData(Resource *r, ResourceItem *item, const deCONZ::ApsDataIndicat
switch (dataType)
{
case TuyaDataTypeRaw:
{
// Not setting value because need to much ressource.
zclDataType = deCONZ::ZclCharacterString;
}
break;

case TuyaDataTypeString:
return result; // TODO implement?

Expand Down
190 changes: 190 additions & 0 deletions devices/tuya/_TZE204_ac0fhfiq_energy_meter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
{
"schema": "devcap1.schema.json",
"manufacturername": "_TZE204_ac0fhfiq",
"modelid": "TS0601",
"product": "BiDirectional ZigBee Energy Meter",
"sleeper": true,
"status": "Gold",
"subdevices": [
{
"type": "$TYPE_CONSUMPTION_SENSOR",
"restapi": "/sensors",
"uuid": [
"$address.ext",
"0x01",
"0x0702"
],
"items": [
{
"name": "attr/id"
},
{
"name": "attr/lastannounced"
},
{
"name": "attr/lastseen"
},
{
"name": "attr/manufacturername"
},
{
"name": "attr/modelid"
},
{
"name": "attr/name"
},
{
"name":"attr/swversion",
"read":{
"at":"0x0001",
"cl":"0x0000",
"ep":1,
"fn": "zcl:attr"
},
"parse":{
"at":"0x0001",
"cl":"0x0000",
"ep":1,
"fn": "zcl:attr",
"script":"tuya_swversion.js"
}
},
{
"name": "attr/type"
},
{
"name": "attr/uniqueid"
},
{
"name": "config/on"
},
{
"name": "config/reachable"
},
{
"name": "state/consumption",
"read": {
"fn": "tuya"
},
"parse": {
"dpid": 1,
"eval": "Item.val = Attr.val * 10;",
"fn": "tuya"
},
"default": 0
},
{
"name": "state/consumption_2",
"read": {
"fn": "none"
},
"parse": {
"dpid": 2,
"eval": "Item.val = Attr.val * 10;",
"fn": "tuya"
},
"default": 0
},
{
"name": "state/lastupdated"
}
]
},
{
"type": "$TYPE_POWER_SENSOR",
"restapi": "/sensors",
"uuid": [
"$address.ext",
"0x01",
"0x0b04"
],
"items": [
{
"name": "attr/id"
},
{
"name": "attr/lastannounced"
},
{
"name": "attr/lastseen"
},
{
"name": "attr/manufacturername"
},
{
"name": "attr/modelid"
},
{
"name": "attr/name"
},
{
"name":"attr/swversion",
"read":{
"at":"0x0001",
"cl":"0x0000",
"ep":1,
"fn": "zcl:attr"
},
"parse":{
"at":"0x0001",
"cl":"0x0000",
"ep":1,
"fn": "zcl:attr",
"script":"tuya_swversion.js"
}
},
{
"name": "attr/type"
},
{
"name": "attr/uniqueid"
},
{
"name": "config/on"
},
{
"name": "config/reachable"
},
{
"name": "state/current",
"read": {
"fn": "none"
},
"parse": {
"dpid": 6,
"eval": "Item.val = ((ZclFrame.at(8) << 16) | (ZclFrame.at(9) << 8) | ZclFrame.at(10)) / 1000;",
"fn": "tuya"
},
"default": 0
},
{
"name": "state/lastupdated"
},
{
"name": "state/power",
"read": {
"fn": "none"
},
"parse": {
"dpid": 101,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
},
"default": 0
},
{
"name": "state/voltage",
"read": {
"fn": "none"
},
"parse": {
"dpid": 6,
"eval": "Item.val = ((ZclFrame.at(6) << 8) | ZclFrame.at(7)) / 10;",
"fn": "tuya"
},
"default": 0
}
]
}
]
}

0 comments on commit 92e8c4e

Please sign in to comment.