Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save marazmarci/64b72558cab7aaa2f81200c1db9a9407 to your computer and use it in GitHub Desktop.

Select an option

Save marazmarci/64b72558cab7aaa2f81200c1db9a9407 to your computer and use it in GitHub Desktop.
SODA S8 Window Handle Zigbee2MQTT external converter v2: changed property names
const exposes = require("zigbee-herdsman-converters/lib/exposes");
const tuya = require("zigbee-herdsman-converters/lib/tuya");
const e = exposes.presets;
const ea = exposes.access;
module.exports = {
fingerprint: tuya.fingerprint("TS0601", ["_TZE200_j7sgd8po"]),
model: "S8",
vendor: "SODA",
description: "S8 premium window handle EXT v2: changed property names",
toZigbee: [tuya.tz.datapoints],
fromZigbee: [tuya.fz.datapoints],
configure: tuya.configureMagicPacket,
exposes: [
e.battery(),
e.battery_low(),
e.binary("vacation", ea.STATE_SET, "ON", "OFF").withDescription("Vacation mode"),
e.enum("alarm", ea.STATE, ["ALARM", "IDLE"]).withDescription("Alarm"),
e.binary("alarm_switch", ea.STATE_SET, "ON", "OFF").withDescription("Alarm enable"),
e.binary("handlesound", ea.STATE_SET, "ON", "OFF").withDescription("Handle closed sound"),
e.enum("opening_mode", ea.STATE, ["closed", "tilted"]).withDescription("Window tilt"),
e.temperature(),
e.humidity(),
e.binary("keysound", ea.STATE_SET, "ON", "OFF").withDescription("Key beep sound"),
e.enum("sensitivity", ea.STATE_SET, ["off", "low", "medium", "high", "max"]).withDescription("Sensitivity of the alarm sensor"),
e.enum("position", ea.STATE, ["up", "right", "down", "left"]),
e.enum("left_button", ea.STATE, ["released", "pressed"]),
e.enum("right_button", ea.STATE, ["released", "pressed"]),
e.numeric("alarm_duration", ea.STATE_SET).withValueMin(0).withValueMax(300).withValueStep(1).withUnit("sec").withDescription("Duration of the alarm").withPreset("default", 180, "Default value"),
e.numeric("update_frequency", ea.STATE_SET).withUnit("min").withDescription("Update frequency").withValueMin(0).withValueMax(700).withPreset("default", 20, "Default value"),
e.enum("calibrate", ea.STATE_SET, ["clear", "execute"]),
],
meta: {
tuyaDatapoints: [
[3, "battery", tuya.valueConverter.raw],
[8, "temperature", tuya.valueConverter.divideBy10],
[101, "humidity", tuya.valueConverter.raw],
[102, "alarm", tuya.valueConverterBasic.lookup({IDLE: tuya.enum(0), ALARM: tuya.enum(1),}),],
[103, "opening_mode", tuya.valueConverterBasic.lookup({closed: tuya.enum(0), tilted: tuya.enum(1),}),],
[104, "position", tuya.valueConverterBasic.lookup({left: tuya.enum(4), up: tuya.enum(1), down: tuya.enum(2), right: tuya.enum(3),}),],
[105, "left_button", tuya.valueConverterBasic.lookup({released: tuya.enum(0), pressed: tuya.enum(1),}),],
[106, "right_button", tuya.valueConverterBasic.lookup({released: tuya.enum(0), pressed: tuya.enum(1),}),],
[107, "vacation", tuya.valueConverterBasic.lookup({OFF: tuya.enum(0), ON: tuya.enum(1),}),],
[108, "sensitivity", tuya.valueConverterBasic.lookup({off: tuya.enum(0), low: tuya.enum(1), medium: tuya.enum(2), high: tuya.enum(3), max: tuya.enum(4),}),],
[109, "alarm_switch", tuya.valueConverterBasic.lookup({OFF: tuya.enum(0), ON: tuya.enum(1),}),],
[110, "update_frequency", tuya.valueConverter.raw],
[111, "keysound", tuya.valueConverterBasic.lookup({OFF: tuya.enum(0), ON: tuya.enum(1),}),],
[112, "battery_low", tuya.valueConverterBasic.lookup({ON: tuya.enum(0), OFF: tuya.enum(1),}),],
[113, "alarm_duration", tuya.valueConverter.raw],
[114, "handlesound", tuya.valueConverterBasic.lookup({OFF: tuya.enum(0), ON: tuya.enum(1),}),],
[120, "calibrate", tuya.valueConverterBasic.lookup({clear: tuya.enum(0), execute: tuya.enum(1),}),],
],
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment