local device = {} device.model = "SPM02" device.vendor = "Tuya" device.description = "Smart energy monitor for 3P+N system" device.exposes = { { type = "numeric", name = "voltage_X", property = "voltage_X", access = 1, unit = "V", description = "Measured electrical potential value (phase X)", }, { type = "numeric", name = "voltage_Y", property = "voltage_Y", access = 1, unit = "V", description = "Measured electrical potential value (phase Y)", }, { type = "numeric", name = "voltage_Z", property = "voltage_Z", access = 1, unit = "V", description = "Measured electrical potential value (phase Z)", }, { type = "numeric", name = "power_X", property = "power_X", access = 1, unit = "W", description = "Instantaneous measured power (phase X)", }, { type = "numeric", name = "power_Y", property = "power_Y", access = 1, unit = "W", description = "Instantaneous measured power (phase Y)", }, { type = "numeric", name = "power_Z", property = "power_Z", access = 1, unit = "W", description = "Instantaneous measured power (phase Z)", }, { type = "numeric", name = "current_X", property = "current_X", access = 1, unit = "A", description = "Instantaneous measured electrical current (phase X)", }, { type = "numeric", name = "current_Y", property = "current_Y", access = 1, unit = "A", description = "Instantaneous measured electrical current (phase Y)", }, { type = "numeric", name = "current_Z", property = "current_Z", access = 1, unit = "A", description = "Instantaneous measured electrical current (phase Z)", }, { type = "numeric", name = "energy", property = "energy", access = 1, unit = "kWh", description = "Total forward active energy", }, { type = "numeric", name = "produced_energy", property = "produced_energy", access = 1, unit = "kWh", description = "Total reverse active energy", }, } device.fromZigbee = { "metering" } device.tuyaDatapoints = { { dp = 1, name = "energy", converter = "divideBy100" }, { dp = 2, name = "produced_energy", converter = "divideBy100" }, } device.configure = { bind = { "seMetering" }, reporting = { { cluster = "seMetering", attribute = "currentSummDelivered", min = 5, max = 3600, change = 1, }, }, } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE204_ves1ycwx", }, { model = "TS0601", manufacturer = "_TZE284_ves1ycwx", }, { model = "TS0601", manufacturer = "_TZE200_ves1ycwx", }, } return device