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


Can interactive push notifications only run a scene or device?


Recommended Posts

Posted

All,

 

I have a scene that runs an interactive push notification at 22:00 each night if the minimum forecast temp is below 10 degrees.

I then have the yes response run another scene to change a global variable to "heat".

A third scene then triggers at 06:00 each morning and if the global variable is set to "heat" the HVAC system is activated.

 

What I am wondering is whether I can get the yes response to do other actions such as setGlobalVariable, hub.debug etc?

 

Any thoughts?

 

Thanks,

 

Anth.

 

hub.setGlobalVariable("MornHVAC", "Off")
hub.sleep(1000)
 
mess = "Overnight minimum temperature is " .. tostring(hub.getGlobalVariable("WeatherTmin")) .. ". Do you want the Heater on at 06:00?"
 
if tonumber(hub.getGlobalVariable("WeatherTmin")) <=10.0 then
    print( "Minimum Temperature is below threshold - trigger interactive push notification")
    print(mess)
    api.post("/mobile/push",
        {
        ["category"] = "YES_NO",
        ["title"] = "Cold Morning",
        ["message"] = mess,
        ["mobileDevices"] = {[1] = 269, },
        ["data"] = {
            ["action"] = "Run",
            ["service"] = "Scene",
            ["sceneId"] = 102
        }
        }
        )
end
Posted (edited)

Ohh at first sight I misunderstood your question.

So, actually you can do it in LUA, or by using two block scenes.

If you are not familiar with LUA, use the 2 block scenes way.

In first you set up the push action where you select the second scene, and in that second scene you just do the global variable setting process. Thats the easiest way. It is actually the way you did it in your example.

Doing it in lua needs a bit of coding.

You need to define an event listener ,that in your case will be probably a a time trigger upon which the push notification will be sent, than you define a function for the push notification containing the callback function that will do the action part of the YES button press.

I think it is easier for you to use 2 scenes.

Edited by Neo Andersson

Join the conversation

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

Guest
Reply to this topic...

×   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...