Sign in   |  Join   |  Help
Untitled Page

ARCHIVED FORUM -- March 2012 to February 2022
READ ONLY FORUM

This is the second Archived Forum which was active between 1st March 2012 and 23rd February 2022

 

What's your favourite macro?

rated by 0 users
This post has 0 Replies | 1 Follower

1990
Top 150 Contributor
Posts 521
OFFLINE
Bronze Member
1990 Posted: Tue, Sep 7 2021 3:48 PM

Hi all, 

There are some fabulous threads on this board with people showing off their equipment. I think it's time to share some BLI/BLGW programming too... In the Khimo thread there are already some nice macro's but a central thread could be helpful I guess.

So: what is your favourite macro that you have created?

For now, mine is a variant on the toilet macro that I first seen here on BeoWorld: the bathroom automation. I have a KNX-sensor in the bathroom and a BeoPlay M3. The sensor sends its signal to the BLGW, triggering both light and sound macro's. Light and sound is depending on the time of day (and for the lights, the cloudiness). A virtual button creates a 60 minute window in which the sound won't be influenced by the sensor. This is due to the sensor thinking the bathroom is empty if I am reading in the bath :)

I hope you are willing to share some of your favourite macro's and provide some inspiration for me and others to keep programming :-)

SOUND MACRO:

function(event, engine)

local time = engine.query("*/*/SYSTEM/Clock/")

local music_player_address = "*/*/AV renderer/*"

local bathroom_address = "Boven/Badkamer/AV renderer/BeoPlay M3"

local music_player = engine.query(music_player_address)[1]

if music_player.get("sourceUniqueId") ~= "" 

      then

    if tonumber(time[1].get("hour")) > 6 and tonumber(time[1].get("hour")) < 19 then engine.fire(bathroom_address .. "/Send command?Command=JOIN&Continue type=short_press")

else  

    if tonumber(time[1].get("hour")) > 19 and tonumber(time[1].get("hour")) < 21 then engine.fire(bathroom_address .. "/Select source?Connector=&Origin=local&Source Type=DEEZER")

end end end end

LIGHT MACRO:

function(event, engine) 

  local time = engine.query("*/*/SYSTEM/Clock/")

  local light_address = "Boven/Badkamer/DIMMER/*"

  local wolken = engine.query("global/global/_CURRENT_WEATHER/Thuis")

        engine.fire("Boven/Badkamer/MACRO/Sensor 0/CANCEL")

if tonumber(time[1].get("hour")) == 0 then engine.fire(light_address .. "/SET?LEVEL=5") else

if tonumber(time[1].get("hour")) == 1 then engine.fire(light_address .. "/SET?LEVEL=5") else

if tonumber(time[1].get("hour")) == 2 then engine.fire(light_address .. "/SET?LEVEL=5") else

if tonumber(time[1].get("hour")) == 3 then engine.fire(light_address .. "/SET?LEVEL=5") else

if tonumber(time[1].get("hour")) == 4 then engine.fire(light_address .. "/SET?LEVEL=5") else

if tonumber(time[1].get("hour")) == 5 then engine.fire(light_address .. "/SET?LEVEL=5") else

if tonumber(time[1].get("hour")) == 6 then engine.fire(light_address .. "/SET?LEVEL=25") else

if tonumber(time[1].get("hour")) == 7 then engine.fire(light_address .. "/SET?LEVEL=75") else

if tonumber(time[1].get("hour")) == 8 then engine.fire(light_address .. "/SET?LEVEL=75") else

if tonumber(time[1].get("hour")) == 19 then engine.fire(light_address .. "/SET?LEVEL=75") else

if tonumber(time[1].get("hour")) == 20 then engine.fire(light_address .. "/SET?LEVEL=60") else

if tonumber(time[1].get("hour")) == 21 then engine.fire(light_address .. "/SET?LEVEL=50") else

if tonumber(time[1].get("hour")) == 22 then engine.fire(light_address .. "/SET?LEVEL=25") else

if tonumber(time[1].get("hour")) == 23 then engine.fire(light_address .. "/SET?LEVEL=5") else

if tonumber(wolken[1].get("_Cloudiness")) > 60 then

engine.fire(light_address .. "/SET?LEVEL=50")  end end end end end end

BUTTON MACRO:

function(event, engine)

  engine.delay(3600,0)

  engine.fire("Boven/Badkamer/BUTTON/In het bad/_SET STATE?STATE=0")

end 

Page 1 of 1 (1 items) | RSS