Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo - Bypass Toggle Logic #2

Open
uudruid74 opened this issue Jun 18, 2018 · 4 comments
Open

Demo - Bypass Toggle Logic #2

uudruid74 opened this issue Jun 18, 2018 · 4 comments
Labels
good first issue Good for newcomers

Comments

@uudruid74
Copy link
Owner

Sometimes you want to turn something on (or off) and not toggle it. For example, if a device is already on and you run a morning routine that turns it on again, you don't want it to go off, but that's exactly what sending the command again will do. Here is one method to tackle this:

[CHECK powerTvOn]
host = 192.168.12.73
on = PRINT TV Already On
off = power

[CHECK powerTvOff]
host = 192.168.12.73
off = PRINT TV Already Off 
on = power

This assumes that "power" is defined in your "Commands" section and toggle's the power. Instead of using "power" directly, use powerTVOn and powerTvOff in your Macros. This checks to see if the host if on by pinging it. On some models, this may fail if it keeps it's network on, but it gives you an idea of how to work some of this stuff.

@uudruid74 uudruid74 added the good first issue Good for newcomers label Jun 18, 2018
@radinsky
Copy link

Just now I'm seeing it.
When I run the "morning routine" I would check the status of the particular device that maybe turned on and I don't want to toggle it again, if it's off I will call the powerTvOn.

Anyway, at my home all of the switches and etc have separate commands for on and off (and not the only one for toggle only).

@uudruid74
Copy link
Owner Author

@radinsky Right, my remote just has a button for TV Power. So, the "powerTvOn" command is defined as "CHECK" which checks to see if the IP is alive. If it's ON, it prints the status (and sends it back to the client). If it's off, it runs the "power" command, which is the IR.

I've just got a little RF remote I picked up for $1 with 3 AC Outlets. It has separate ON and OFF commands, but since all I have is the BlackBean Mini, and it can't talk to RF devices, I'll be adding GPIO support to this project. It's running on a Beaglebone so I have plenty of GPIO lines to play with. I'm not exactly sure how that will look in the config file just yet, but it seems a logical addition. I'm just waiting for a couple 4066 ICs to control the remote buttons with and it will all be wired into the BeagleBone.

@uudruid74
Copy link
Owner Author

Now turning off lights and fans using GPIO lines!

@uudruid74
Copy link
Owner Author

New behavior.

If a command ends in on or off (MACRO or otherwise) then a global Status variable checked (0 for off, 1 for on) to make sure the device is not already in the given state. If it is, a warning is issued and no further processing is done. Otherwise, it sets the variable to the new state and then will look for a command without the "on" or "off" in the name. If found, it executes it. Othewise, it defaults into trying to find an IR code with on or off already in the command name.

However, this is great for many things, but its more reliable to test if a host is up, as in the first example. However, you always ping a device to see if its on as many keep the network stack on all the time (for example, my Vizio only works with the above in Eco mode, not Fast mode, since Fast keeps the network stack up when the TV is off).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants