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

Question
stefafo 0
Hello, I'm new at this forum and sorry for my english.
I am trying to make a scene with blocks (since I haven't learned LUA yet) and an interactive push notification.
The wanted function is:
I want the interactive push to ask me only on weekdays (monday-friday) at a specific time and only if the temperature is below a certain value (for example 5degrees celsius)
If the temperature is below, I have the option to start another scene with a "yes or no" option in the notification, if the temperature is above it should not ask at all.
As the block scene is right now I think it asks me everytime the temperature sensor reports a new value.
(Image on block scene attached)
This is how it looks when I convert from block to LUA:
--[[
%% autostart
%% properties
326 value
%% weather
%% events
%% globals
--]]
local sourceTrigger = fibaro:getSourceTrigger();
function tempFunc()
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
( tonumber(fibaro:getValue(326, "value")) < 5 )
and
( ((currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "06:30") )
)
then
api.post('/mobile/push', {["mobileDevices"]={234}, ["message"]=[[INTERACTIVE PUSH QUESTION HERE]], ["title"]='NAME HERE OF THE SCENE THAT COULD BE STARTED', ["category"]='YES_NO', ["data"]={["sceneId"]=2}});
end
setTimeout(tempFunc, 60*1000)
end
if (sourceTrigger["type"] == "autostart") then
tempFunc()
else
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
( tonumber(fibaro:getValue(326, "value")) < 5 )
and
( (currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6) )
or
startSource["type"] == "other"
)
then
api.post('/mobile/push', {["mobileDevices"]={234}, ["message"]=[[INTERACTIVE PUSH QUESTION HERE]], ["title"]='NAME HERE OF THE SCENE THAT COULD BE STARTED', ["category"]='YES_NO', ["data"]={["sceneId"]=2}});
end
end
Please login or register to see this attachment.
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.