I think this driver will work but I’m not very good with the CLI to upload it.
–[[
This is the driver configuration.
You can modify these settings to match your needs.
]]
local driver_name = “MOES Tuya ZigBee Smart IR Remote Control”
local device_id = “moes-tuya-zigbee-smart-ir-remote-control”
local device_type = “zigbee”
local device_manufacturer = “MOES”
local device_model = “Tuya ZigBee Smart IR Remote Control”
local device_fingerprint = {
manufacturer = “MOES”,
model = “Tuya ZigBee Smart IR Remote Control”,
fingerprint = “0x0102030405060708090A0B0C0D0E0F”
}
–[[
This is the driver code.
This code handles the communication between SmartThings and the MOES Tuya ZigBee Smart IR Remote Control.
]]
local driver = {}
function driver.on_initialize()
– Initialize the driver.
log.info(“Initializing driver…”)
– Connect to the MOES Tuya ZigBee Smart IR Remote Control.
local device = zigbee.connect(device_id)
if device == nil then
log.error("Failed to connect to device.") return
end
– Set the device name.
device:set_name(driver_name)
– Set the device type.
device:set_type(device_type)
– Set the device manufacturer.
device:set_manufacturer(device_manufacturer)
– Set the device model.
device:set_model(device_model)
– Register for events.
device:register_event(“on_button_press”)
device:register_event(“on_button_release”)
log.info(“Driver initialized.”)
end
function driver.on_button_press(event)
– Handle a button press event.
log.info("Button pressed: " … event.button)
– Send a command to the MOES Tuya ZigBee Smart IR Remote Control.
device:send_command(event.button)
end
function driver.on_button_release(event)
– Handle a button release event.
log.info("Button released: " … event.button)
end
return driver