Lua: The "methods()" function

Moderator: Telldus

Post Reply
jonle
Posts: 1
Joined: Fri Mar 17, 2023 9:45 am

Lua: The "methods()" function

Post by jonle »

When I write my lua scripts I find it hard to know what methods are available for a certain device. It seems like the 'methods()' could help me, so I tried

Code: Select all

local deviceManager = require "telldus.DeviceManager"
local device = deviceManager:findByName("doorbell")
print(device:methods())
but this only returned an integer(?), 36 in the case of the Nexa LML-710 doorbell. How am I supposed to use the methods(), and in general where can I find information on issues such as this?

In this specific case I am trying to send a command other than the standard "on" or "bell" to the doorbell, in order to utilize its full range of different sounds. Any tips or help on this would also be appreciated :)
fcorin
Posts: 19
Joined: Fri Mar 17, 2023 9:45 am

Re: Lua: The "methods()" function

Post by fcorin »

Device methods:
TELLSTICK_TURNON = 1
TELLSTICK_TURNOFF = 2
TELLSTICK_BELL = 4
TELLSTICK_TOGGLE = 8
TELLSTICK_DIM = 16
TELLSTICK_LEARN = 32
TELLSTICK_EXECUTE = 64
TELLSTICK_UP = 128
TELLSTICK_DOWN = 256
TELLSTICK_STOP = 512

4 (bell) + 32 (learn) = 36

I don't think you can set the sound using the methods, the sound is set when you learn your bell.
--
Fredrik
Post Reply