Closed xvolte closed 1 year ago
Can you please read the template properly and provide all screenshots and details as requested ?
done, i had an issue reading the device again, i needed to repair it
i think this is the Best Link (and quite new : From yesterday) to add support : https://github.com/Koenkk/zigbee2mqtt/discussions/17325#discussioncomment-5772907
Still missing Groups screenshot.
And the model id / manufacturer name in the template text itself.
really sorry about that, hope all is ok now
All good :)
First time I try this kind of device ... may be all is not working at first try
{
"schema": "devcap1.schema.json",
"manufacturername": "_TZE200_nlrfgpny",
"modelid": "TS0601",
"product": "Tuya Smart Zigbee Siren Alarm",
"sleeper": false,
"status": "Silver",
"subdevices": [{
"type": "$TYPE_WARNING_DEVICE",
"restapi": "/lights",
"uuid": [
"$address.ext",
"0x01"
],
"items": [{
"name": "attr/id"
},
{
"name": "attr/lastannounced"
},
{
"name": "attr/lastseen"
},
{
"name": "attr/manufacturername"
},
{
"name": "attr/modelid"
},
{
"name": "attr/name"
},
{
"name": "attr/swversion",
"parse": {
"fn": "zcl",
"ep": 1,
"cl": "0x0000",
"at": "0x0001",
"script": "tuya_swversion.js"
},
"read": {
"fn": "zcl",
"ep": 1,
"cl": "0x0000",
"at": "0x0001"
}
},
{
"name": "attr/type"
},
{
"name": "attr/uniqueid"
},
{
"name": "config/alert",
"description": "Alarm mode, 0 : sound, 1: light, 2 : Sound and light. Default 0",
"values": [
["0", "Sound"],
["1", "Light"],
["2", "Sound & light"]
],
"read": {
"fn": "none"
},
"write": {
"dpid": 102,
"dt": "0x2b",
"eval": "Mode = ['0','1','2']; Attr.val = Math.max(0,Mode.indexOf(Item.val));",
"fn": "tuya"
},
"parse": {
"dpid": 102,
"eval": "Item.val = String(Attr.val);",
"fn": "tuya"
},
"default": "0"
},
{
"name": "config/melody",
"description": "Alarm melody, from 0 to 2. Default 1",
"range": [0, 2],
"read": {
"fn": "none"
},
"write": {
"dpid": 21,
"dt": "0x2b",
"eval": "Item.val;",
"fn": "tuya"
},
"parse": {
"dpid": 21,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
},
"default": 1
},
{
"name": "config/duration",
"description": "Alarm duration. Default 10",
"read": {
"fn": "none"
},
"write": {
"dpid": 5,
"dt": "0x2b",
"eval": "Item.val;",
"fn": "tuya"
},
"parse": {
"dpid": 5,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
},
"default": 10
},
{
"name": "state/battery",
"description": "Charge state 0: Not Charging, 1: Charging",
"read": {
"fn": "none"
},
"parse": {
"dpid": 6,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
}
},
{
"name": "state/reachable"
}
]
},
{
"type": "$TYPE_ALARM_SENSOR",
"restapi": "/sensors",
"uuid": [
"$address.ext",
"0x01",
"0x0500"
],
"fingerprint": {
"profile": "0x0104",
"device": "0x0403",
"endpoint": "0x01",
"in": [
"0x0000",
"0x0004",
"0x0005",
"0xef00"
],
"out": [
"0x0019",
"0x000A"
]
},
"items": [{
"name": "attr/id"
},
{
"name": "attr/lastannounced"
},
{
"name": "attr/lastseen"
},
{
"name": "attr/manufacturername"
},
{
"name": "attr/modelid"
},
{
"name": "attr/name"
},
{
"name": "attr/swversion",
"parse": {
"fn": "zcl",
"ep": 1,
"cl": "0x0000",
"at": "0x0001",
"script": "tuya_swversion.js"
},
"read": {
"fn": "zcl",
"ep": 1,
"cl": "0x0000",
"at": "0x0001"
}
},
{
"name": "attr/type"
},
{
"name": "attr/uniqueid"
},
{
"name": "config/enrolled",
"public": false
},
{
"name": "config/tuya_unlock"
},
{
"name": "config/on",
"description": "Alarm switch",
"range": [0, 1],
"read": {
"fn": "none"
},
"write": {
"dpid": 13,
"dt": "0x10",
"eval": "Item.val == 1 ? 1 : 0;",
"fn": "tuya"
},
"parse": {
"dpid": 13,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
},
"default": 0
},
{
"name": "config/pending"
},
{
"name": "config/reachable"
},
{
"name": "state/tampered",
"read": {
"fn": "none"
},
"parse": {
"dpid": 20,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
}
},
{
"name": "state/alarm",
"read": {
"fn": "none"
},
"parse": {
"dpid": 101,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
}
},
{
"name": "config/battery",
"refresh.interval": 3600,
"read": {
"fn": "none"
},
"parse": {
"dpid": 15,
"eval": "Item.val = Attr.val / 2;",
"fn": "tuya"
}
},
{
"name": "state/lastupdated"
},
{
"name": "state/deviceruntime",
"description": "Alarm time",
"read": {
"fn": "none"
},
"parse": {
"dpid": 7,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
}
},
{
"name": "state/lowbattery",
"read": {
"fn": "none"
},
"parse": {
"dpid": 110,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
}
}
]
}
],
"bindings": [{
"bind": "unicast",
"src.ep": 1,
"cl": "0xEF00"
}]
}
nice:) thank you! how do i test it ?
i got a conbee 2 attached to a rpi 4 running Home Assistant :D
Thanks in advance!
May be this coud help : https://github.com/dresden-elektronik/deconz-rest-plugin/issues/6806#issuecomment-1476606167
Nice thank you. I was able to add the DDF, however i can't see the device in Home Assistant. i'm now rebooting HA, in case something is done at startup, but else, i don't know how to test it !
So the only thing i changed was to make the melody a public item.
it now looks like this :
but still got nothing in Home Assistant : No device / no entity
Because the DDF is silver and that probably isn't enabled..
Because the DDF is silver and that probably isn't enabled..
I miss this precision, DDF level had to be Silver (https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/How-to-change-DDF-modes-and-enable-or-disable-DDF-levels)
progress: changing it to gold and doing a hot reload and read node, changed things :
but from there, i'm stuck:
looks like it is a wrong device type. maybe we should consider this as a switch, so that i can on/off the alarm ?
progress: changing it to gold and doing a hot reload and read node, changed things :
but from there, i'm stuck:
looks like it is a wrong device type. maybe we should consider this as a switch, so that i can on/off the alarm ?
Don't check with Phoscon , check with the rest api or something like home assistant. Phoscon needs to add support on itself.
REST-API only knows lights or sensors, no switch device type. This DDF should have add two new devices, one light that support most of the configuration parts, and one sensor that support most of the reported events from the device.
so i reverted to silver and enabled support for silver. can't find sensors or light ...
so i reverted to silver and enabled support for silver. can't find sensors or light ...
If it has been loaded once changed into Gold it should be loaded when changing DeConz level to Silver and revert the DDF to Silver. Have you deleted the device and added it again ?
if i delete the device, i need to pair it again, and since i need to put the custom DDF file on the device ... it will be configured after joining ... or am i missing something ?
If the DDF is stored in the right folder it will be loaded automatically when DeConz will detect the manufactueername and modelid match those in a DDF. If you have to load it by hands it's because the DDF is not in the right place ... or the Level in the DDF doesn't match the level into DeConz.
You can leave the DDF in Gold if you want, it doesn't really matter in your environment.
the DDF has been stored here : /data/.local/share/dresden-elektronik/deCONZ/devices/ does the name of the js file matters ?
does the name of the js file matters ?
Not really, it just have to have extension.json
, like tuyasiren.json
a reboot of Home Assistant did the trick:
still waiting for the switch to come online
on the sensor side : battery says 0% but it should be 100% charged
Hmmm may be DDF need some adjustements or waitings ... . Tuya usually use battery update after max 4 hours as a kind of heartbeat. If that dosn't work it could be that calculation is wrong.
device kept saying offline, i removed it, i'm going to pair it again after the reboot
Hmmm may be DDF need some adjustements or waitings ... . Tuya usually use battery update after max 4 hours as a kind of heartbeat. If that dosn't work it could be that calculation is wrong.
i think the guy on the other website mentionned a "In charge" or not, so 0 or 1 sensor, when it is plugged to a usb cable. anyway, we will see in couple of minute after Re pairing
I masked the "in charge state" behind the state/battery
of the light device but I may be light doesn't expose this on REST-API.
We could add a pseudo ZHABattery sensor just for that but will see later if it's necessary
so i did it again, it does create a device but i can't change the switches
I'm a bit surprised that you just have one more device, should have two. Could you got aceess to the REST-API directly rather than using HA ? https://dresden-elektronik.github.io/deconz-rest-doc/
maybe it is also because I never configured the device ? like the alarm sound and so on? maybe I should first set those values ?
maybe it is also because I never configured the device ? like the alarm sound and so on? maybe I should first set those values ?
Don't think so. You should have two devices, configured or not. I you don't have two then may be this is a DDF issue ... What a request like http;//<your deconz ip address>:<and port number>/api/<your apikey>/lights
gives ? same with /sensors
at the end in place of /lights
Sensor:
switch:
light:
i noticed this in your script :
do i have this script somewhere ?
do i have this script somewhere ?
Seesm you don't have it where you put the DDF file but it doesn't matter for now. It just updates swversion item and we can see that later ... Don't worry about that. ;-)
Then you have to devices (light as "TuyaSiren" and sensor as "Alarm 47"). Seems that light device doesn't expose all items, as I was afraid of. We have to find other way to gain access to them. BTW for the moment we can focus on sensor items to see if they are updated ...
ok, what do you want me to do ? so far, i can't see anything updating (or it is already "up to date")
Well, i changed of approach after looking at what REST-API exposes : You will have to delte device one more time, changing DDF with this one and pairing device again please. I based the DPID from the links you referenced, hope there were functionnal ;-) But to be honest I'm still confused between dpip 102 (alarm mode) and dpid 1 (alarm state)
{
"schema": "devcap1.schema.json",
"manufacturername": "_TZE200_nlrfgpny",
"modelid": "TS0601",
"product": "Tuya Smart Zigbee Siren Alarm",
"sleeper": false,
"status": "Silver",
"subdevices": [{
"type": "$TYPE_WARNING_DEVICE",
"restapi": "/lights",
"uuid": [
"$address.ext",
"0x01"
],
"items": [{
"name": "attr/id"
},
{
"name": "attr/lastannounced"
},
{
"name": "attr/lastseen"
},
{
"name": "attr/manufacturername"
},
{
"name": "attr/modelid"
},
{
"name": "attr/name"
},
{
"name": "attr/swversion",
"parse": {
"fn": "zcl",
"ep": 1,
"cl": "0x0000",
"at": "0x0001",
"script": "tuya_swversion.js"
},
"read": {
"fn": "zcl",
"ep": 1,
"cl": "0x0000",
"at": "0x0001"
}
},
{
"name": "attr/type"
},
{
"name": "attr/uniqueid"
},
{
"name": "config/tuya_unlock"
},
{
"name": "state/alert",
"default": "none"
},
{
"name": "config/on",
"description": "Alarm switch On or Off",
"range": [0, 1],
"read": {
"fn": "none"
},
"write": {
"dpid": 13,
"dt": "0x10",
"eval": "Item.val == 1 ? 1 : 0;",
"fn": "tuya"
},
"parse": {
"dpid": 13,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
},
"default": 0
},
{
"name": "state/reachable"
}
]
},
{
"type": "$TYPE_ALARM_SENSOR",
"restapi": "/sensors",
"uuid": [
"$address.ext",
"0x01",
"0x0500"
],
"fingerprint": {
"profile": "0x0104",
"device": "0x0403",
"endpoint": "0x01",
"in": [
"0x0000",
"0x0004",
"0x0005",
"0xef00"
],
"out": [
"0x0019",
"0x000A"
]
},
"items": [{
"name": "attr/id"
},
{
"name": "attr/lastannounced"
},
{
"name": "attr/lastseen"
},
{
"name": "attr/manufacturername"
},
{
"name": "attr/modelid"
},
{
"name": "attr/name"
},
{
"name": "attr/swversion",
"parse": {
"fn": "zcl",
"ep": 1,
"cl": "0x0000",
"at": "0x0001",
"script": "tuya_swversion.js"
},
"read": {
"fn": "zcl",
"ep": 1,
"cl": "0x0000",
"at": "0x0001"
}
},
{
"name": "attr/type"
},
{
"name": "attr/uniqueid"
},
{
"name": "config/enrolled",
"public": false
},
{
"name": "config/on",
"description": "Alarm switch On or Off",
"range": [0, 1],
"read": {
"fn": "none"
},
"write": {
"dpid": 13,
"dt": "0x10",
"eval": "Item.val == 1 ? 1 : 0;",
"fn": "tuya"
},
"parse": {
"dpid": 13,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
},
"default": 0
},
{
"name": "config/pending"
},
{
"name": "config/reachable"
},
{
"name": "state/tampered",
"read": {
"fn": "none"
},
"parse": {
"dpid": 20,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
}
},
{
"name": "state/alarm",
"description": "Tamper alarm switch",
"read": {
"fn": "none"
},
"parse": {
"dpid": 101,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
},
"write": {
"dpid": 101,
"dt": "0x10",
"eval": "Item.val == 1 ? 1 : 0;",
"fn": "tuya"
}
},
{
"name": "config/alert",
"description": "Alarm mode, 0 : sound, 1: light, 2 : Sound and light. Default 0",
"values": [
["0", "Sound"],
["1", "Light"],
["2", "Sound & light"]
],
"read": {
"fn": "none"
},
"write": {
"dpid": 102,
"dt": "0x2b",
"eval": "Mode = ['0','1','2']; Attr.val = Math.max(0,Mode.indexOf(Item.val));",
"fn": "tuya"
},
"parse": {
"dpid": 102,
"eval": "Item.val = String(Attr.val);",
"fn": "tuya"
},
"default": "0"
},
{
"name": "config/melody",
"description": "Alarm melody, from 0 to 2. Default 1",
"range": [0, 2],
"read": {
"fn": "none"
},
"write": {
"dpid": 21,
"dt": "0x2b",
"eval": "Item.val;",
"fn": "tuya"
},
"parse": {
"dpid": 21,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
},
"default": 1
},
{
"name": "config/duration",
"description": "Alarm duration. Default 10",
"read": {
"fn": "none"
},
"write": {
"dpid": 5,
"dt": "0x2b",
"eval": "Item.val;",
"fn": "tuya"
},
"parse": {
"dpid": 5,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
},
"default": 10
},
{
"name": "state/lastupdated"
},
{
"name": "state/deviceruntime",
"description": "Alarm time",
"read": {
"fn": "none"
},
"parse": {
"dpid": 7,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
}
}
]
},
{
"type": "$TYPE_BATTERY_SENSOR",
"restapi": "/sensors",
"uuid": ["$address.ext", "0x01", "0x0001"],
"fingerprint": {
"profile": "0x0104",
"device": "0x0402",
"endpoint": "0x01",
"in": [
"0x0000",
"0x0004",
"0x0005",
"0xef00"
],
"out": [
"0x0019",
"0x000A"
]
},
"items": [{
"name": "attr/manufacturername"
},
{
"name": "attr/modelid"
},
{
"name": "attr/name"
},
{
"name": "attr/swversion",
"parse": {
"fn": "zcl",
"ep": 1,
"cl": "0x0000",
"at": "0x0001",
"script": "tuya_swversion.js"
},
"read": {
"fn": "zcl",
"ep": 1,
"cl": "0x0000",
"at": "0x0001"
}
},
{
"name": "attr/type"
},
{
"name": "attr/uniqueid"
},
{
"name": "attr/lastseen"
},
{
"name": "config/on"
},
{
"name": "config/reachable"
},
{
"name": "config/battery",
"refresh.interval": 1800,
"read": {
"fn": "none"
},
"parse": {
"dpid": 15,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
}
},
{
"name": "state/on",
"access": "R",
"description": "Charge state 0: Not Charging, 1: Charging",
"read": {
"fn": "none"
},
"parse": {
"dpid": 6,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
}
},
{
"name": "state/lowbattery",
"read": {
"fn": "none"
},
"parse": {
"dpid": 110,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
}
},
{
"name": "state/lastupdated"
}
]
}
],
"bindings": [{
"bind": "unicast",
"src.ep": 1,
"cl": "0xEF00"
}]
}
nice:
I now have the switch, but it is not working (when i click on it, it goes back to off in 1 sec) and the siren is not screaming yet :D BAttery 48 sensor :
Warning device 15 (light) :
It should have 1 light and 2 sensors now. Will try something else, for the light part, can you change
{
"name": "config/on",
"description": "Alarm switch On or Off",
"range": [0, 1],
"read": {
"fn": "none"
},
"write": {
"dpid": 13,
"dt": "0x10",
"eval": "Item.val == 1 ? 1 : 0;",
"fn": "tuya"
},
"parse": {
"dpid": 13,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
},
"default": 0
},
by
{
"name": "state/on",
"description": "Alarm switch On or Off",
"read": {
"fn": "none"
},
"write": {
"dpid": 1,
"dt": "0x10",
"eval": "Item.val == 1 ? 1 : 0;",
"fn": "tuya"
},
"parse": {
"dpid": 1,
"eval": "Item.val = Attr.val;",
"fn": "tuya"
},
"default": 0
},
new file, new bug : i didn't change the filename, only the content .... but he won't read it anymore ?
Error in the content. Most likely the comma or Accolade.
it was missing a "," in the modification after "Alarm switch On or Off",
You're right, my mistake. Sorry (post updated). Then are you able to activate the device ?
nope
Are you using the rest api to activate or home assistant?
I strongly advice to use the rest api
home assistant :D i'll try but it is not that easy as the deconz is running within a container, not accessible from my LAN, only home assistant has access to it, so i have trouble sending command to the api within the container
home assistant :D i'll try but it is not that easy as the deconz is running within a container, not accessible from my LAN, only home assistant has access to it, so i have trouble sending command to the api within the container
The addon has the option to forward the ports.
So what do you want me to try ?
i did that : PUT http://myip:port/api/xxxxxx/lights/15/state
with this json: { "alert": "lselect", "on": true }
results: [{"success":{"/lights/15/state/on":true}},{"success":{"/lights/15/state/alert":"lselect"}}]
but no sound
Device
Screenshots
Basic
Identify
Alarms
Device Temperature
Groups
Scenes
On/Off
Level Control
Color Control
Simple Metering
Diagnostics
Other clusters that are not mentioned above