Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

[SOLVED]Need Scene for bathroom radio


Splinter

Question

Hello everybody

I need a scene where the following happens

If motion is detected, a button in a VD should be started
If there is no more movement in the room, a timer should start, which when it expires again starts a button in a VD.

The goal is that my bathroom radio is turned on when I enter the room and when I leave it it goes out after a short time.

The whole script should be as simple as possible.

The best would be if the whole thing would happen at a certain time because the radio in the time between 22:00 and 5:00 should not tackle.

Can anybody help me with this ?

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0
56 minutes ago, Bodyart said:

Hi @Thomasn,

 

I woul'd like to use such piece of code if you woul'd like to share it :-)

 

 

--[[
%% autostart
%% properties
128 value
127 value
%% weather
%% events
%% globals
--]]

local radio = 147; -- Fibaro plug with radio
local pir = 128; -- Pir in bathroom
local starttimer = 40; -- Time for radio to play in seconds
local timer = (starttimer); -- timer for loop

if (fibaro:countScenes()>1) then 
    fibaro:abort();  
end

-- Start program ———————————————————  
if (( tonumber(fibaro:getValue(pir, "value")) > 0 )) then
      fibaro:debug(“Movement. Starting radio”)

    fibaro:call(radio, "turnOn”);
  
-- loop start ————————————————————— 
    repeat 
           timer=timer-1; 
           fibaro:sleep(1000);
    
        -- If movement then reset time ————————
         if (tonumber(fibaro:getValue(pir, "value"))) > 0 then 
             timer=starttimer; 
             fibaro:debug(“Movement. Time is reset”);
         end 
    until (timer<1) 

      fibaro:call(radio, "turnOff”);
      fibaro:debug(“No movement. Program terminated”)
end

-- Some of the "--" have been changed during the upload to "--". Change them back or the program will not work. The "- -" (no space and no quotation marks) statement is used in lua script to insert comments.

Edited by Thomasn
Link to comment
Share on other sites

  • 0

The topic has been moved from "

Please login or register to see this link.

" to "

Please login or register to see this link.

".

 

Temat został przeniesiony z "

Please login or register to see this link.

" do "

Please login or register to see this link.

".

Link to comment
Share on other sites

  • 0

What radio are we talking about? I have a lua program that does what you ask for. It is triggered by a Fibaro eye and a Sonos One will start a radio program. It work as long as someone is in the bathroom and will end 60 secs after movement stops.

 

Is that something that you want?

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...