Valentine’s Heart Animation
Domoticz

Valentine’s Heart Animation

This script creates an animated heart sequence on the AWTRIX3 display, perfectly timed to bring Valentine’s Day cheer!
A flow by Galadril

Download flow

Flow Details

❤️ AWTRIX3 Valentine’s Heart Animation Script ❤️

💡 Script Purpose:
This script creates an animated heart sequence on the AWTRIX3 display, perfectly timed to bring Valentine’s Day cheer!

heart_animation

⚙️ Script Activation:
The script is always active by default, as indicated by active = true.

🎛️ Trigger:
The animation is triggered by a device called 'SwithValentine', ensuring the heart animation starts only when manually activated.

📝 Logging:
Custom logging is used with a marker "AWTRIX_HEART" for easy identification of Valentine-specific log entries.

🔍 Conditions:

  1. The device "AWTRIX3 - Power" is checked to ensure the AWTRIX3 display is powered on:
    🛑 If "AWTRIX3 - Power" is not found or is Off, the script halts execution.
  2. The device "AWTRIX3 - Send Custom App" is verified:
    🛑 If this device is not found, an error is logged, and the script stops further actions.

🚀 Execution Flow:
Once the conditions are met:

  1. A sequence of five animated heart frames is prepared as JSON payloads.
  2. Each frame contains a precise arrangement of pixel data ("dp") with colors (e.g., "#971B23" for deep red and "#FFFF00" for yellow accents).
  3. These frames are explicitly sent to the AWTRIX3 device (AWTRIX3 - Send Custom App) with timed intervals using .afterSec() for smooth animation.

🎥 Animation Details:

  • The heart evolves frame by frame, starting as a small core and expanding into a detailed, glowing heart with outer yellow highlights.
  • The animation loops seamlessly with a dynamic flow and vibrant red hues, creating an engaging visual display.

Final Touch:
A log entry "Animation scheduling completed." confirms the animation setup is successfully scheduled.


🌹 Valentine’s Special:
This creative script ensures your AWTRIX3 display spreads love and warmth, making it a delightful centerpiece for Valentine’s Day celebrations!


🔗 More Information:

return { active = true, on = { devices = { 'SwithValentine' } }, logging = { level = domoticz.LOG_INFO, marker = "AWTRIX_HEART" }, execute = function(domoticz) local appDevice = domoticz.devices('AWTRIX3 - Send Custom App') if not appDevice then domoticz.log("AWTRIX3 - Send Custom App device not found", domoticz.LOG_ERROR) return end -- JSON payloads for the animation steps (as strings) local animationFrames = { -- Start of Heart (as a JSON string) '{"draw":[{"dp":[14,3,"#971B23"]},{"dp":[15,3,"#971B23"]},{"dp":[13,4,"#971B23"]},{"dp":[16,4,"#971B23"]},{"dp":[12,5,"#971B23"]},{"dp":[17,5,"#971B23"]},{"dp":[13,6,"#971B23"]},{"dp":[16,6,"#971B23"]},{"dp":[14,7,"#971B23"]},{"dp":[15,7,"#971B23"]}]}', '{"draw":[{"dp":[13,2,"#971B23"]},{"dp":[14,2,"#971B23"]},{"dp":[15,2,"#971B23"]},{"dp":[16,2,"#971B23"]},{"dp":[12,3,"#971B23"]},{"dp":[17,3,"#971B23"]},{"dp":[11,4,"#971B23"]},{"dp":[18,4,"#971B23"]},{"dp":[12,5,"#971B23"]},{"dp":[17,5,"#971B23"]},{"dp":[13,6,"#971B23"]},{"dp":[16,6,"#971B23"]},{"dp":[14,7,"#971B23"]},{"dp":[15,7,"#971B23"]}]}', '{"draw":[{"dp":[12,1,"#971B23"]},{"dp":[13,1,"#971B23"]},{"dp":[16,1,"#971B23"]},{"dp":[17,1,"#971B23"]},{"dp":[11,2,"#971B23"]},{"dp":[14,2,"#971B23"]},{"dp":[15,2,"#971B23"]},{"dp":[18,2,"#971B23"]},{"dp":[10,3,"#971B23"]},{"dp":[19,3,"#971B23"]},{"dp":[11,4,"#971B23"]},{"dp":[18,4,"#971B23"]},{"dp":[12,5,"#971B23"]},{"dp":[17,5,"#971B23"]},{"dp":[13,6,"#971B23"]},{"dp":[16,6,"#971B23"]},{"dp":[14,7,"#971B23"]},{"dp":[15,7,"#971B23"]}]}', '{"draw":[{"dp":[12,1,"#971B23"]},{"dp":[13,1,"#971B23"]},{"dp":[16,1,"#971B23"]},{"dp":[17,1,"#971B23"]},{"dp":[11,2,"#971B23"]},{"dp":[12,2,"#FFFFFF"]},{"dp":[13,2,"#FFFFFF"]},{"dp":[14,2,"#971B23"]},{"dp":[15,2,"#971B23"]},{"dp":[16,2,"#FF0000"]},{"dp":[17,2,"#FF0000"]},{"dp":[18,2,"#971B23"]},{"dp":[10,3,"#971B23"]},{"dp":[11,3,"#FF0000"]},{"dp":[12,3,"#FFFFFF"]},{"dp":[13,3,"#FF0000"]},{"dp":[14,3,"#FF0000"]},{"dp":[15,3,"#FF0000"]},{"dp":[16,3,"#FF0000"]},{"dp":[17,3,"#FF0000"]},{"dp":[18,3,"#D01B23"]},{"dp":[19,3,"#971B23"]},{"dp":[11,4,"#971B23"]},{"dp":[12,4,"#FF0000"]},{"dp":[13,4,"#FF0000"]},{"dp":[14,4,"#FF0000"]},{"dp":[15,4,"#FF0000"]},{"dp":[16,4,"#FF0000"]},{"dp":[17,4,"#D01B23"]},{"dp":[18,4,"#971B23"]},{"dp":[12,5,"#971B23"]},{"dp":[13,5,"#FF0000"]},{"dp":[14,5,"#FF0000"]},{"dp":[15,5,"#FF0000"]},{"dp":[16,5,"#D01B23"]},{"dp":[17,5,"#971B23"]},{"dp":[13,6,"#971B23"]},{"dp":[14,6,"#FF0000"]},{"dp":[15,6,"#D01B23"]},{"dp":[16,6,"#971B23"]},{"dp":[14,7,"#971B23"]},{"dp":[15,7,"#971B23"]}]}', '{"draw":[{"dp":[12,1,"#971B23"]},{"dp":[13,1,"#971B23"]},{"dp":[16,1,"#971B23"]},{"dp":[17,1,"#971B23"]},{"dp":[11,2,"#971B23"]},{"dp":[12,2,"#FFFFFF"]},{"dp":[13,2,"#FFFFFF"]},{"dp":[14,2,"#971B23"]},{"dp":[15,2,"#971B23"]},{"dp":[16,2,"#FF0000"]},{"dp":[17,2,"#FF0000"]},{"dp":[18,2,"#971B23"]},{"dp":[10,3,"#971B23"]},{"dp":[11,3,"#FF0000"]},{"dp":[12,3,"#FFFFFF"]},{"dp":[13,3,"#FF0000"]},{"dp":[14,3,"#FF0000"]},{"dp":[15,3,"#FF0000"]},{"dp":[16,3,"#FF0000"]},{"dp":[17,3,"#FF0000"]},{"dp":[18,3,"#D01B23"]},{"dp":[19,3,"#971B23"]},{"dp":[11,4,"#971B23"]},{"dp":[12,4,"#FF0000"]},{"dp":[13,4,"#FF0000"]},{"dp":[14,4,"#FF0000"]},{"dp":[15,4,"#FF0000"]},{"dp":[16,4,"#FF0000"]},{"dp":[17,4,"#D01B23"]},{"dp":[18,4,"#971B23"]},{"dp":[12,5,"#971B23"]},{"dp":[13,5,"#FF0000"]},{"dp":[14,5,"#FF0000"]},{"dp":[15,5,"#FF0000"]},{"dp":[16,5,"#D01B23"]},{"dp":[17,5,"#971B23"]},{"dp":[13,6,"#971B23"]},{"dp":[14,6,"#FF0000"]},{"dp":[15,6,"#D01B23"]},{"dp":[16,6,"#971B23"]},{"dp":[14,7,"#971B23"]},{"dp":[15,7,"#971B23"]},{"dp":[12,0,"#FFFF00"]},{"dp":[17,0,"#FFFF00"]},{"dp":[10,1,"#FFFF00"]},{"dp":[19,1,"#FFFF00"]},{"dp":[9,3,"#FFFF00"]},{"dp":[20,3,"#FFFF00"]},{"dp":[10,5,"#FFFF00"]},{"dp":[19,5,"#FFFF00"]},{"dp":[12,8,"#FFFF00"]},{"dp":[17,8,"#FFFF00"]}]}' } domoticz.log("AWTRIX3 turned on, starting heart animation.", domoticz.LOG_INFO) -- Explicitly schedule each frame update appDevice.setDescription(animationFrames[1]).afterSec(0.5) appDevice.switchOn().afterSec(1) appDevice.setDescription(animationFrames[2]).afterSec(1.5) appDevice.switchOn().afterSec(2) appDevice.setDescription(animationFrames[3]).afterSec(2.5) appDevice.switchOn().afterSec(3) appDevice.setDescription(animationFrames[4]).afterSec(3.5) appDevice.switchOn().afterSec(4) appDevice.setDescription(animationFrames[5]).afterSec(4) appDevice.switchOn().afterSec(4.5) domoticz.log("Animation scheduling completed.", domoticz.LOG_INFO) end }
-- Flow first published on January 7, 2025, last updated on January 7, 2025 at 10:19.