Jump to content
C4 Forums | Control4

Change variable state when power button is pressed


Recommended Posts


@Crustyloafer

The TV and projector are in the same room. I have created a IR driver for the TV. If i turn on/off the TV using the remote, I can't get a feedback from the TV to check whether it's on or off. So i'm updating another variable to assume that the TV is on/off. So if someone clicks the power button from the mobile phone, it should turn the tv on/off based on the variable state and update the variable. 

This is required because if i turn on the projector, the TV should turn off or if the TV is already turned off, it should ignore the TV

Link to comment
Share on other sites

18 minutes ago, Dinushan Paranavithana said:

@Crustyloafer

The TV and projector are in the same room. I have created a IR driver for the TV. If i turn on/off the TV using the remote, I can't get a feedback from the TV to check whether it's on or off. So i'm updating another variable to assume that the TV is on/off. So if someone clicks the power button from the mobile phone, it should turn the tv on/off based on the variable state and update the variable. 

This is required because if i turn on the projector, the TV should turn off or if the TV is already turned off, it should ignore the TV

I personally never have used a toggle command.. I would use a variable to track last state of your 1st variable. then you know that the last variable was correct so trigger off of that!

I do this to toggle camera source and main video source using a single * command on the remote

Link to comment
Share on other sites

I have assigned custom buttons of the remote to turn on/off the tv or projector. Since the projector cannot be turned off immediately once it is turned on, i have added timers to update a variable called 'CommandIsReadyToSend'. If the variable 'CommandIsReadyToSend' is 'True', the functions assigned to the custom buttons would work. If not, the command is not sent. 

Prog1.jpg

prog2.jpg

Link to comment
Share on other sites

3 hours ago, c4toys said:

Ok, so in your boardroom-room variables-power state make a conditional IF room power is on set -variable TEST to True, IF room power is Off set -variable TEST to False

I want to toggle the device state. If the 'TV' is selected, we can see the menu given below. So I want the TV to turn off/on using the 'Power' button. In order to achieve this, i'm trying to toggle the variables state when ever i hit the power button.

POWER.jpg

Link to comment
Share on other sites

Have you considered using the 'Theater Display Switcher' driver in the Control4 driver database, it is specifically for switching between two displays in the same room, especially between a TV and projector. You can also assign a TV lift mechanism to the TV and a motorised projector screen and projector lift so that it knows they need to go up/down as required when switching displays.

See screenshot below:

https://www.dropbox.com/s/7joftxvr4p250xu/Screenshot 2019-05-27 19.24.17.png?dl=0

Link to comment
Share on other sites

  • 2 weeks later...

Yes I tried it @Crustyloafer. Thanks, but i wanted to try it for another purpose. 

I found the issue. I have deleted the power command from the tv template driver  (Driver Wizard) when i created a custom driver for the TV. I have added my own command called 'power' later to assign the on/off toggle IR code value. 

It's good if control4 can allow us to create a GUI menu for the driver that we create, where we can add our own commands and assign them to our own buttons we design in our GUI. 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.