cloud_devices module API ( require “cloud_devices” )
subscribe(script_name[, events_filter])
- Subscribe a script for cloud_devices events, optionally specifying event filter rules. After subscribing the script will be launched for each event happens on a dloud_devices addon and information about this event will be passed as a parameter.
set_subscription_filters(subscriber_id, filter_rules)
- Change events filter rules for a subscription . (set_subscription_filters)
get_device()
- Get cloud device by its device id. (device id is a part of data coming to a script subscribed for cloud devices events)
send_command()
- Send command to a specified cloud device capability.
Edit
- params: command_id (string), cloud_device_id (string), capability (string), command (string), command_params (table).
- return: none.
Edit
require "cloud_devices"
local status, error_msg = pcall(cloud_devices.send_command, command_id, cloud_device_id, "text_command", "send", { text = "turn on the light" })
if not status then
print("Error sending command: " .. error_msg)
end
Capability | Supported commands | Supported parameters |
---|---|---|
text_command | send | text (string) |