local device = {} device.model = "OSP 240" device.vendor = "Innr" device.description = "Outdoor smart plug" device.zigbeeModel = { "OSP 240" } device.exposes = { { type = "switch", features = { { type = "binary", name = "state", property = "state", access = 7, value_on = "ON", value_off = "OFF", description = "On/off state of the switch", }, }, }, { type = "enum", name = "power_on_behavior", property = "power_on_behavior", access = 7, description = "Controls the behavior when the device is powered on after power loss", category = "config", values = { "off", "on", "toggle", "previous" }, }, { 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, }, }, } return device