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

Lua scene that turns off devices depending on another device state


Dacron
 Share

Question

I have made a lua scene that turns everything off Sky Box, TV, Light, Amp. My problem is if the sky box is already off and I send an IR off it turns Sky on again because the On Off is toggle. Is it possible to have code that sends the IR command depending on the state (on or off) of a device or virtual switch. Thanks

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

You can create a global variable. When you switch on/off the sky box, you can update the global with on or off and then use that variable to define if the other scene should turn off the sky box.

If you have any questions about how to do it, let me know.

Link to comment
Share on other sites

  • 0

what Pete said.

 

I use this for some lights... get & set... all you need to do is create the variable first in settings->general->variables:

mind you.. this is something I just finished today.. but it works. The variable only takes strings but that shouldn't matter here..

Are you not able to poll the skybox status for on or off?

Code for lights:

 

Please login or register to see this code.

 

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Thanks for your comments and the code. I can only control the Sky Box with IR so can’t get feedback but I’ve just purchased a HDMI signal monitor from Amazon that has a set of contacts that close and open with a HDMI signal. I’m going to use a spare smart implant on the contacts to give me real-time feedback as to the Sky box’s state. My family don’t always use Fibaro to turn the box on or off. I now need to send the IR on/off toggle code in different scenes or QA depending on the Smart Implants IN1 state. I’m very new to coding but learning fast. Symbiot78 your code looks like a good starting point thanks. Pete123 I’ve not used Glodal Variables yet but will have a look thanks.

    Link to comment
    Share on other sites

    • 0
    On 2/25/2021 at 11:56 PM, Dacron said:

    Thanks for your comments and the code. I can only control the Sky Box with IR so can’t get feedback but I’ve just purchased a HDMI signal monitor from Amazon that has a set of contacts that close and open with a HDMI signal. I’m going to use a spare smart implant on the contacts to give me real-time feedback as to the Sky box’s state. My family don’t always use Fibaro to turn the box on or off. I now need to send the IR on/off toggle code in different scenes or QA depending on the Smart Implants IN1 state. I’m very new to coding but learning fast. Symbiot78 your code looks like a good starting point thanks. Pete123 I’ve not used Glodal Variables yet but will have a look thanks.

    @Dacron I do the same but easier (I think) by putting a wall switch between on the TV. If the power is < 20 W for more than 1 minute I switch a variable 'TV' to "OFF" and if the powerconsumption > 20 W for more than one minute the same variable is set to "ON". That way it makes no difference how the TV or anything else is switched on or off.

    Edited by wienog
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Thanks @wienog I hadn’t thought of that, I don’t have any switches currently that I can use but I already have a couple of projects that would work brilliantly using that method.

    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.

     Share

    ×
    ×
    • Create New...