local device = {} device.model = "TS011F_2_gang_power" device.vendor = "Tuya" device.description = "2 gang socket with power monitoring and USB" device.exposes = { { type = "switch", endpoint = "left", features = { { type = "binary", name = "state", property = "state_left", access = 7, value_on = "ON", value_off = "OFF", description = "On/off state of the switch", endpoint = "left", }, }, }, { type = "switch", endpoint = "right", features = { { type = "binary", name = "state", property = "state_right", access = 7, value_on = "ON", value_off = "OFF", description = "On/off state of the switch", endpoint = "right", }, }, }, { type = "enum", name = "identify", property = "identify", access = 2, description = "Initiate device identification", category = "config", values = { "identify" }, }, { type = "numeric", name = "power", property = "power", access = 5, unit = "W", description = "Instantaneous measured power", }, { type = "numeric", name = "voltage", property = "voltage", access = 5, unit = "V", description = "Measured electrical potential value", }, { type = "numeric", name = "current", property = "current", access = 5, unit = "A", description = "Instantaneous measured electrical current", }, { type = "numeric", name = "energy", property = "energy", access = 5, unit = "kWh", description = "Sum of consumed energy", }, } device.fromZigbee = { "on_off", "electrical", "metering" } device.toZigbee = { "on_off" } device.configure = { bind = { "genOnOff", "haElectricalMeasurement", "seMetering" }, reporting = { { cluster = "genOnOff", attribute = "onOff", min = 0, max = 3600, change = 0, }, { cluster = "haElectricalMeasurement", attribute = "activePower", min = 5, max = 3600, change = 1, }, { cluster = "haElectricalMeasurement", attribute = "rmsVoltage", min = 5, max = 3600, change = 5, }, { cluster = "haElectricalMeasurement", attribute = "rmsCurrent", min = 5, max = 3600, change = 100, }, { cluster = "seMetering", attribute = "currentSummDelivered", min = 5, max = 3600, change = 1, }, }, } device.meta = { multiEndpoint = true } device.fingerprint = { { model = "TS011F", manufacturer = "_TZ3000_bep7ccew", }, { model = "TS011F", manufacturer = "_TZ3000_gazjngjl", }, } return device