Writing an HSM200 edge driver

– Import necessary libraries
local st = require(“st”)
local capabilities = require(“st.capabilities”)
local zigbee = require(“st.zigbee”)

– Define capabilities
local temperatureMeasurement = capabilities.temperatureMeasurement
local illuminanceMeasurement = capabilities.illuminanceMeasurement
local humidityMeasurement = capabilities.relativeHumidityMeasurement
local motionSensor = capabilities.motionSensor

– Define the driver
local function hsm200Driver(driver, device)
– Define the temperature capability
function temperatureMeasurement.temperature(device)
local temp = zigbee.getTemperature(device)
return temp / 100

– Define the illuminance capability
function illuminanceMeasurement.illuminance(device)
local lux = zigbee.getIlluminance(device)
return lux

– Define the humidity capability
function humidityMeasurement.humidity(device)
local humidity = zigbee.getHumidity(device)
return humidity / 100

– Define the motion sensor capability
function motionSensor.motion(device, value)
if value.value == “active” then
return true
return false

– Register the driver
local hsm200 = “homeseer hsm200 multi-sensor”
local hsm200DeviceProfile = {
vendor = “HomeSeer”,
model = “HSM200”,
profile = “zigbee”,
product = hsm200,
deviceIds = { “0x1260” },
endpointId = “01”
local hsm200Config = {
– No configuration parameters

st:registerDriver(hsm200Driver, hsm200DeviceProfile, hsm200Config)

This would be a lot more readable if you could wrap it in triple back ticks (```).

I’m not sure what this code is intended for, I didn’t listen to all of it, but I did hear “Zigbee” mentioned a couple of times and the Homeseer HSM200 is a zwave device. :thinking: