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

Changing predefined variables from a mobile


gfoden@bit.org.uk

Question

I am a new implementer trying to get my system working in a new house. I have programmed in a commercial sense (years ago) so I am hopefully not stupid but just confused! I have bought "Programming in LUA" by Roberto Ierusalimschy and successfully coded a scene although I still don't understand how it is scheduled! I can't get my mind around a real time system that is programmed in an object oriented way that does not permit events. (Oh for the simplicity of visual basic.)

Now my immediate problem.

The house has 4 bedroom suites but normally 3 of them will be unused. Because there are a myriad of things to control such as the MVHR and the air-conditioning I decided to have four predefined variables, one for each room set to InUse or NotInUse. (probably my first mistake.) Originally I had thought we would set these variables by a physical set of 4 switches, which, either by Fibaro double relays or the universal sensor, I could have made trigger a scene to set the variable.

However we have moved on and decided that things like this should really be set by using the Fibaro App on a smart phone. Only trouble is the panel that would make the variable visible is not provided in the mobile app. Undaunted I thought, "OK I'll write a scene". However what I need is not a scene that runs all the time but one that is triggered by me using it.

So I go to the new scene section and choose graphic blocks. Even though I might end up in LUA at least it will give me a start. Wrong. What you can't do is write a scene without declaring a trigger and I want the trigger to be me running it from a mobile phone, which is not allowed.

I realise now that I don't understand how scenes are run. I've sort of got this idea that they are run every second but the insistence on a triggering device makes me think that perhaps HC2 is cleverer than this and uses the triggering event as a scheduling concept or device. Can I ask the forum please.
What does the choice between Automatic and manual actually do to the scheduling? (I understand Manual runs it when I select run on the phone but how often does it run for automatic. Is it triggered by the triggering event - even if in a general sense of whenever a predefined variable is changed all variable triggered scenes are run? Or is it actually specific to the triggering event. Or perhaps it just gets initiated every second. If it is once a second, then I must code in LUA to cancel my instance if I'm already running.)

How is this modified by ticking "start when HC2 starts" If it doesn't start when HC2 starts what does "Automatic" mean?

Finally can I ask if anyone has any ideas on how to set variables from a mobile phone or is there some other cleaver way to solve the problem.

Is there any product documentation that covers this area - I can't find any?

It would be nice to be able to create say a "Variable device", which presents the predefined values and behaves in all ways like a real device within HC2 including appearing on a mobile. I could then set the variable and trigger scenes simply if not always efficiently. Has anybody created one.

Geoff
 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

See screenshot, is that what you want?

 

Added the VD also, needs 4 global vraiables "bedroom1", "bedroom2", "bedroom3" and "bedroom4"

Please login or register to see this attachment.

Please login or register to see this link.

Link to comment
Share on other sites

  • 0
  • Inquirer
  • It looks very promising. I will study in depth and try and get working. Many thanks for your prompt and on the face of it straightforward solution.

    Can I ask a supplementary question please?

     

    The main loop is described as executing every second but my virtual device can only change state if I execute it from a mobile so what scheduling boxes do I tick or select to cause it to only run when I command it?

     

    Thanks again Geoff

    Link to comment
    Share on other sites

    • 0

    The main loop is described as executing every second but my virtual device can only change state if I execute it from a mobile so what scheduling boxes do I tick or select to cause it to only run when I command it?

     

    With the virtual device you don't need to do anything else. From the mobile you can select a state by pressing a button, the button will do the logic. For now it is only setting a global variable, but you can add more to the button if that is needed.

     

    Keep the questions coming!

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