Flow Details
π Purpose
Having some fun with different effects and animations on the AWTRIX3 clock.
π Activation and Timing
This domoticz dzVents script is marked as active by active = true
.
It executes every 5 minute as specified in the trigger section: timer = {'every 5 minutes'}
.
βοΈ Script Logic
Every time the script is run, it randomly selects one of the available effects from the effects
array.
That effect is then activated as a custom app on the AWTRIX3 unit, using a duration of 10 seconds. If auto transition is activated on the AWTRIX3 the random effect will be included in the loop with the other apps, changing it to another effect/animation every 5 minutes.
π Logging
- Logs are generated with the marker "AWTRIX3_Screensaver" to identify entries related to this script.
- The logging level is set to
domoticz.LOG_INFO
, ensuring that informational messages are captured.
ποΈ Effects Adjustment
Undesired effects can be out-commented from the effects
array by include a 'Lua' comment (' -- ') in front of the line.
βοΈ Required plugins and more information:
- Domoticz: www.domoticz.com
- Domoticz AWTRIX3 Plugin: GitHub - Domoticz-AWTRIX3-Plugin
return {
-- The script is active
active = true,
on = {
timer = {
'every 5 minutes'
}
},
-- Custom logging level for this script
logging = {
level = domoticz.LOG_INFO,
marker = "AWTRIX3_Screensaver"
},
-- Event execution when the timer triggers the script
execute = function(domoticz)
local function getRandomEffect()
-- Define the array of 10 strings
local effects = {
"Fade",
"MovingLine",
"BrickBreaker",
"PingPong",
"Radar",
"Checkerboard",
"Fireworks",
"PlasmaCloud",
"Ripple",
"Snake",
"Pacifica",
"TheaterChase",
"Plasma",
"Matrix",
"SwirlIn",
"SwirlOut",
"LookingEyes",
"TwinklingStars",
"ColorWaves"
}
-- Generate a random index between 1 and the length of the array
local randomIndex = math.random(#effects)
-- Return the string at the random index
return effects[randomIndex]
end
screensaverPage = {
appname = "screensaver",
effect = getRandomEffect(),
duration = 10
}
local pageJSON = domoticz.utils.toJSON(screensaverPage)
domoticz.log("Sending screensaver to AWTRIX3: " .. pageJSON, domoticz.LOG_INFO)
local appDevice = domoticz.devices('AWTRIX3 - Send Custom App')
if appDevice then
appDevice.setDescription(pageJSON)
appDevice.switchOn().afterSec(2)
else
domoticz.log("'AWTRIX3 - Send Custom App' device not found", domoticz.LOG_ERROR)
end
end
}
-- Flow first published on January 6, 2025, last updated on January 6, 2025 at 20:02.