iRayanKhan / homebridge-tuya-platform

This plugin has moved. Check: https://github.com/iRayankhan/homebridge-tuya
Https://Twitter.com/iRayanKhan
MIT License
9 stars 1 forks source link

New Devices? #5

Closed chinloon closed 4 years ago

chinloon commented 4 years ago

I am wondering if generic new devices matching HomeKit's "Sensors" can be added? Will be good it it can report "Temperature", "Humidity", "Other" - any value useful for smoke detectors, and "open/close" - door/windows switches etc...

Thanks!

iRayanKhan commented 4 years ago

Just for reference these are the current compatible devices.

If you can provide the schema for these new devices I can try to add them.

chinloon commented 4 years ago

Thanks, lets start of with a couple of sensors: PIR { name: 'PIR Sensor', id: 'xxx', key: 'nnn', def: { schema: '[ { "mode":"ro", "code":"PIR", "name":"PIR", "property": { "range":["pir"], "type":"enum" }, "id":101, "trigger":"direct", "type":"obj", "desc":"pir \u68c0\u6d4b" }, { "mode":"ro", "code":"battery", "name":"\u7535\u6c60\u7535\u91cf", "property": { "unit":"", "min":0, "max":10000, "scale":0, "step":1, "type":"value" }, "id":103, "type":"obj", "desc":"mcu \u4e0a\u62a5\u7535\u6c60\u7535\u91cf" } ]', }, },

and, Temp/Humidity Sensor with Siren

{ name: 'Siren with Sensor', id: 'xx', key: 'nnn', def: { schema: '[ { "mode":"ro", "code":"BatteryStatus", "name":"\u7535\u91cf\u72b6\u6001", "property": { "range":["0","1","2","3","4"], "type":"enum" }, "id":101, "type":"obj", "desc":" 0\uff1a\u6ee1\u7535\n1\uff1a\u9ad8\n2\uff1a\u4e2d\n3\uff1a\u4f4e\n4\uff1a\u5916\u7535" }, { "mode":"rw", "code":"Alarmtype", "name":"\u58f0\u97f3\u7c7b\u578b", "property": { "range":["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18"], "type":"enum" }, "id":102, "type":"obj", "desc":"\u6bcf\u4e00\u79cd\u4ee3\u8868\u4e00\u79cd\u58f0\u97f3" }, { "mode":"rw", "code":"AlarmPeriod", "name":"\u62a5\u8b66\u65f6\u957f", "property": { "unit":"\u79d2", "min":0, "max":1800, "scale":0, "step":10, "type":"value" }, "id":103, "type":"obj", "desc":"\u65f6\u95f4\u95f4\u9694\u8bbe\u7f6e" }, { "mode":"rw", "code":"AlarmSwitch", "name":"\u62a5\u8b66\u5f00\u5173", "property": { "type":"bool" }, "id":104, "type":"obj", "desc":"\u58f0\u97f3\u62a5\u8b66\u5f00\u5173" }, { "mode":"ro", "code":"temperature", "name":"\u6e29\u5ea6", "property": { "unit":"\u2103", "min":-20, "max":80, "scale":0, "step":1, "type":"value" }, "id":105, "type":"obj", "desc":"" }, { "mode":"ro", "code":"humidity", "name":"\u5f53\u524d\u6e7f\u5ea6", "property": { "unit":"%RH", "min":1, "max":100, "scale":0, "step":1, "type":"value" }, "id":106, "type":"obj", "desc":"" }, { "mode":"rw", "code":"temperature_min_set", "name":"\u6e29\u5ea6\u6700\u5c0f\u503c\u8bbe\u7f6e", "property": { "unit":"\u2103", "min":-20, "max":80, "scale":0, "step":1, "type":"value" }, "id":107, "type":"obj", "desc":"\u8bbe\u7f6e\u6e29\u5ea6\u9600\u503c\u7684\u6700\u5c0f\u503c" }, { "mode":"rw", "code":"temperature_max_set", "name":"\u6e29\u5ea6\u6700\u5927\u503c\u8bbe\u7f6e", "property": { "unit":"", "min":-20, "max":80, "scale":0, "step":1, "type":"value" }, "id":108, "type":"obj", "desc":"\u8bbe\u7f6e\u6e29\u5ea6\u9600\u503c\u7684\u6700\u5927\u503c" }, { "mode":"rw", "code":"humidity_min_set", "name":"\u6e7f\u5ea6\u6700\u5c0f\u503c\u8bbe\u7f6e", "property": { "unit":"%RH", "min":1, "max":100, "scale":0, "step":1, "type":"value" }, "id":109, "type":"obj", "desc":"\u8bbe\u7f6e\u6e7f\u5ea6\u6700\u5c0f\u503c" }, { "mode":"rw", "code":"humidity_max_set", "name":"\u6e7f\u5ea6\u6700\u5927\u503c\u8bbe\u7f6e", "property": { "unit":"%RH", "min":1, "max":100, "scale":0, "step":1, "type":"value" }, "id":110, "type":"obj", "desc":"\u6e7f\u5ea6\u6700\u5927\u503c\u8bbe\u7f6e" }, { "mode":"rw", "code":"C_F", "name":"\u6e29\u6807", "property": { "type":"bool" }, "id":112, "type":"obj", "desc":"\u6444\u6c0f\u5ea6\u548c\u534e\u6c0f\u5ea6\u5207\u6362" }, { "mode":"rw", "code":"temperatureswitch", "name":"\u6e29\u5ea6\u62a5\u8b66\u5f00\u5173", "property": { "type":"bool" }, "id":113, "type":"obj", "desc":"\u53ef\u8bbe\u7f6e\u6e29\u5ea6\u62a5\u8b66\u5f00\u6216\u8005\u5173" }, { "mode":"rw", "code":"humidityswitch", "name":"\u6e7f\u5ea6\u62a5\u8b66\u5668\u5f00\u5173", "property": { "type":"bool" }, "id":114, "type":"obj", "desc":"\u53ef\u8bbe\u7f6e\u6e7f\u5ea6\u62a5\u8b66\u5f00\u6216\u8005\u5173" }, { "mode":"ro", "code":"Alarm_Status", "name":"\u62a5\u8b66\u7c7b\u578b", "property": { "range":["0","1","2","3","4","6","8","9","12"], "type":"enum" }, "id":115, "type":"obj", "desc":"0 \u89e3\u9664\u62a5\u8b66\n1 \u9ad8\u6e29\u62a5\u8b66 \n2 \u9ad8\u6e7f\u62a5\u8b66\n3 \u9ad8\u6e29\u9ad8\u6e7f\u62a5\u8b66\n4 \u4f4e\u6e29\u62a5\u8b66\n6 \u4f4e\u6e29\u9ad8\u6e7f\u62a5\u8b66\n8 \u4f4e\u6e7f\u62a5\u8b66\n9 \u9ad8\u6e29\u4f4e\u6e7f\u62a5\u8b66\n12 \u4f4e\u6e29\u4f4e\u6e7f\u62a5\u8b66" } ]', }, },

iRayanKhan commented 4 years ago

Hi @chinloon I have some news.

These sensor accessories only communicate with the cloudAPI which this plugin can't handle, and only respond per event (Source; codetheweb Tuya plugin issue # 33.)

There may be a slime chance of hope if this works for you: https://github.com/kueblc/mocktuyacloud

Other than that it's not possible at the moment to add these accessories into HomeKit. I can try to make a janky workaround, but the reliability and stability it not going to be present.