The config library allows for interaction between the pilight configuration and configured pilight devices.
Warning
Not all devices are currently supported in the config library. More devices will be added in the future.
New in version 8.1.3.
A new version object must be initialized before the different configuration subsections can be used:
local config = pilight.config();
local devobj = config.getDevice("switch");
local standalone = config.getSetting("standalone");
Changed in version 8.1.3.
pilight.config
()].getDevice(string device)¶The device parameter should correspond to a valid configured device. If the device isn’t configured a nil
is returned.
New in version 8.1.2.
pilight.config.getDevice
(string device)¶The device parameter should correspond to a valid configured device. If the device isn’t configured a nil
is returned.
getActionId
()¶Gets the unique device identifier.
getId
()¶Returns the device id multidimensional table.
local config = pilight.config();
local dev = config.device("dimmer");
local id = dev.getId();
print(id[1]['id']); -- 1
print(id[1]['unit']); -- 0
print(id[2]['id']); -- 6
print(id[2]['unit']); -- 2
getName
()¶Returns the name of the device
getType
()¶Returns the device types of the configured device in an array.
hasSetting
(string setting)¶Checks if the device has a specific setting. If this is true, a corresponding getter and setter are present. E.g. hasSetting('dimlevel')
corresponds to setDimlevel(1)
and getDimlevel()
setActionId
()¶Sets a unique identifier for this specific device. This identifier is used to check if an action execution should be aborted or not.
getDay
()¶Returns the day of the datetime device.
getMonth
()¶Returns the month of the datetime device.
getYear
()¶Returns the year of the datetime device.
getHour
()¶Returns the hour of the datetime device.
getMinute
()¶Returns the hour of the datetime device.
getSecond
()¶Returns the seconds of the datetime device.
getWeekday
()¶Returns the weekday of the datetime device.
getDST
()¶Returns the daylight savings time of the datetime device.
getTable
()¶Returns a datetime table with year, month, day, hour, minute, second keys with their corresponding values.
getDimlevel
()¶Returns the dimlevel of the dimmer.
getState
()¶Returns the state of the dimmer.
hasState
(string state)¶Check if this dimmer can be set to a specific state.
hasDimlevel
(number dimlevel)¶Check if this dimmer can be set to a specific dimlevel.
setState
(string state)¶Set the dimmer to a specific device.
setDimlevel
(number dimlevel)¶Set the dimmer to a specific dimlevel.
send
()¶Sends the new settings to the dimmer.
getLabel
()¶Returns the label of the label.
getColor
()¶Returns the color of the label.
setLabel
(string label)¶Set the label to a specific label.
setLabel
(string label)Set the label label to a specific color.
send
()Sends the new settings to the label.
getState
()Returns the state of the switch.
hasState
(string state)Check if this switch can be set to a specific state.
setState
(string state)Set the switch to a specific state.
send
()Sends the new settings to the switch.
getState
()Returns the state of the screen.
hasState
(string state)Check if this screen can be set to a specific state.
setState
(string state)Set the screen to a specific state.
send
()Sends the new settings to the screen.
Changed in version 8.1.3.
pilight.config
()].getSetting(string setting)Returns the value of a specific setting in the pilight configuration. If a setting was not configured, a nil
is returned.
New in version 8.1.2.
pilight.config.setting
(string setting)¶Returns the value of a specific setting in the pilight configuration. If a setting was not configured, a nil
is returned.