Touch URLs Devices, Variables, Folders?

Posted on
Sun Jan 29, 2023 12:25 pm
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Touch URLs Devices, Variables, Folders?

So I've got the control page linking working....

indigo or indigodomo or indigocontrol://controlpage/controlpagename

What is it for the device tab, variable tab, can you go a layer deeper into a device folder?

Bill
My Plugin: My People

Posted on
Wed Feb 01, 2023 11:54 am
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: Touch URLs Devices, Variables, Folders?

Hi Bill,

Indigo Touch currently only supports URLs for opening specific Control Pages.

Image

Posted on
Wed Feb 01, 2023 3:23 pm
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Touch URLs Devices, Variables, Folders?

Upside, the way around is to use the refector address for it and open the devices, variables, actions/etc pages with safari.

example for a device sub folder (devices / climate)...
Code: Select all
https://username:password@username.indigodomo.net/controlpagename=_internal_devices_&uiName=Climate&asList=1&folderFilter=488543452&useJS=True

Even when represented as a single character in a hyperlink., like an emoji symbol, all those characters count towards the character limit of a pushover message.

I made a beautiful script to generate a system status message with highlights of key systems and pretty emoji hyperlinks to take me back to indigo if I want to quickly get more information on that system. Once I went back and added all the hyperlinks, only part of my message was coming through. Little more research later to find out I was hitting the character limit with pushover. The emailed version of my status message is still pretty. Hence the desire for a shorter direct link.

Bill
My Plugin: My People

Posted on
Thu Feb 02, 2023 11:06 pm
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Re: Touch URLs Devices, Variables, Folders?

Can you post a screenshot of something that worked? This sounds really useful, and I literally just read the emoji discovery post.

Posted on
Fri Feb 03, 2023 12:07 am
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Touch URLs Devices, Variables, Folders?

mundmc wrote:
Can you post a screenshot of something that worked? This sounds really useful, and I literally just read the emoji discovery post.


I have a "Status Message" script that basically returns 3 different messages. A pushover version, an email version and a verbal version. They all fire from the same script. The verbal just updates a variable with the message sandwiched between "<speak> bla bla bla </speak>" If I ask alexa for the house status, the script runs (I get a pushover, email and the alexa routine asks indigo to speak the variblename.) By the time alexa gets around to speaking the varible (2 or 3 second delay), the variable has already been updated. The end of the routine asks it to speak from whatever device I made the request from.

The top row of my pushover message is 7 characters of emojis. If everything is good, I should have dashes all the way across. If there is something on that shouldn't be, someone gone that should be home, a door that's open that should be closed, etc, there is an emoji that gets put in it's place. That way, at a glance at the top line of a pushover, I can get a snapshot of the current house status.

People check is based on FindfriendsMini data when everyone is home. Currently my youngest forgot to charge her phone, so it's showing as offline.
All doors, locks, windows are closed so the security message is blank.

Only two lights on in the house right now.

TV check looks for powered on TVs. (Roku tv's that have an on/off status).

Weather compares outside temp to inside to populate a "colderoutside = true/false" then, example, if it's colder outside and the AC is on and all doors/windows are closed, the pushover message is "It's a cool XXX degrees outside and the AC is on." Email: "It's XX degrees colder outside and the AC is on, you can open a window. Conversely if it warms up outside and a window is still open, the message will be something about closing the window.

It's probably more complicated than it needs to be, but I was having fun trying to figure out how much data I could cram into the smallest space possible.

Right now, all the pushover links just go to the indigo touch main page. The email version goes to specific device group pages and stuff, because I had more text room to have longer hyperlink addresses.
Attachments
IMG_6712.PNG
IMG_6712.PNG (393.53 KiB) Viewed 1737 times

Bill
My Plugin: My People

Posted on
Fri Feb 03, 2023 6:39 am
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Touch URLs Devices, Variables, Folders?

Email Version generated from the same script. I did look at/consider putting inline images versus emojis (which is limited), but the level of python wizardry to insert an image inline is crazy.

My other though (to get around character limits in Pushover) is to just create a "links control page" and just have one "more info" link in the pushover message. That link page could then go to another indigo control page or out to safari for a devices page, etc. I'm also getting back into Homekit with the new plugin to see if it's more stable. I like the way its organized with rooms and categories.

End goal is to make it more wife-friendly. She never uses control pages, she usually just goes straight to the devices page and flips around to find stuff.
Attachments
Screenshot 2023-02-03_06-30-31-096.png
Screenshot 2023-02-03_06-30-31-096.png (83.23 KiB) Viewed 1720 times

Bill
My Plugin: My People

Posted on
Wed Feb 15, 2023 5:19 pm
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Touch URLs Devices, Variables, Folders?

That your wife actually uses any implementation other than yelling at Alexa is impressive

This is a really awesome implementation. Thank you for sharing it.

Posted on
Thu Feb 16, 2023 12:26 am
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Touch URLs Devices, Variables, Folders?

mundmc wrote:
That your wife actually uses any implementation other than yelling at Alexa is impressive


Mine refuses to even use Alexa as Alexa doesn’t even listen to her when she asks for a timer.

She will just about use the Apple Home app on her phone so I have everything in there. She wouldn’t use the touch app


mundmc wrote:
This is a really awesome implementation. Thank you for sharing it.

Indeed. My head hurts thinking about how you got this working. Then feels the need to up my game!
It’s why I love indigo though on that we can be this creative.

Posted on
Thu Feb 16, 2023 11:27 am
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Touch URLs Devices, Variables, Folders?

siclark wrote:
Alexa doesn’t even listen to her when she asks for a timer.

That must be universal. No idea. My wife will elevate her command to a yell right next to an echo and maybe get the right response. I can whisper from the other side of the room without issue. When my wife gripes, it's not "Alexa did this", it's "The hooker on the counter"



siclark wrote:
My head hurts thinking about how you got this working.
I took tiny baby steps. Created an action with a script to check one category; lights. Once I got that working, I could duplicate the action and substitute all the light devices for fan devices, etc. Eventually, stitch all the scripts together.

The suck part is there is no generic way to return what is on. You have to have a line for every device you want to check. Add a light, you have to modify the script. I haven't found a grouping plugin that can group together all devices, i.e., create a group device for all your lights. The script would just have to check that one group device.... again, not all devices can be grouped and most group device plugins won't tell you which device in the group is the one that turned the group "on". <-- I could be wrong, maybe I'm not scripting those plugins correctly.... but the long way with a script that checks each device individually does work. It's just a long script and if it gets wonky, it can take a while to troubleshoot it so see where I messed up.

For example, here is my original light check script. The action at the end I don't use anymore and was removed from my final script. My scripts use to run in series. So all lights have to be off before the action would run to check the next thing. (forcing me to shut stuff off to get a complete message). The only other change I made to the final script was to change up the punctuation some to make audio versions sound more natural and duplicated messages to have a short version for text/pushover a longer version for email and another for audio.

Code: Select all
theMessage = ""
isLightsOn = True

if indigo.devices[937130354].onState == True:
   isLightsOn = True
   theMessage = theMessage + "Bill's Office, "

if indigo.devices[65936415].onState == True:
   isLightsOn = True
   theMessage = theMessage + "Vikki's Office, "   
if indigo.devices[1192336408].onState == True:
   isLightsOn = True
   theMessage = theMessage + "Garage, "

if indigo.devices[162659895].onState == True:
   isLightsOn = True
   theMessage = theMessage + "Living Room, "   

if indigo.devices[1053474190].onState == True:
   isLightsOn = True
   theMessage = theMessage + "Dining Room, "

if indigo.devices[1006557169].onState == True:
   isLightsOn = True
   theMessage = theMessage + "Front Hallway, "   
if indigo.devices[1486920762].onState == True:
   isLightsOn = True
   theMessage = theMessage + "Breakfast Table, "

if indigo.devices[55601007].onState == True:
   isLightsOn = True
   theMessage = theMessage + "Pantry, "   

if indigo.devices[1051393994].onState == True:
   isLightsOn = True
   theMessage = theMessage + "Kitchen, "

if indigo.devices[675197519].onState == True:
   isLightsOn = True
   theMessage = theMessage + "Kid Rooms, "
   
if indigo.devices[134858586].onState == True:
   isLightsOn = True
   theMessage = theMessage + "Back Yard, "

if indigo.devices[993557412].onState == True:
   isLightsOn = True
   theMessage = theMessage + "Front Yard, "   

else:
   isLightsOn = False

if isLightsOn == False:
   theMessage = "All Lights Are Off"
   indigo.server.log(theMessage)
   indigo.actionGroup.execute(948838716) # Closeout Script


if isLightsOn == True:
   theMessage = "Lights are still on. Check " + theMessage
   indigo.server.log(theMessage)
   indigo.variable.updateValue(1862150451, theMessage) # send_alexa_variable


I also had to play around with the wording until I would get the correct result. My security script uses two different "if"s

Code: Select all
if indigo.devices[649246778].onState == False:
   sMessage = sMessage + "front door lock, "

if indigo.devices[375771754].states['onOffState'] is True:
   sMessage = sMessage + "Right Garage Door, "


I don't know enough about python to say which is correct, if that is the best way.... but its working so I try not to poke it.

Bill
My Plugin: My People

Posted on
Thu Feb 16, 2023 11:51 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Touch URLs Devices, Variables, Folders?

whmoorejr wrote:
I don't know enough about python to say which is correct, if that is the best way.... but its working so I try not to poke it.


You have a little buglet: your script will only set isLightsOn to False when the last if condition is False:

Code: Select all
if indigo.devices[993557412].onState == True:
   isLightsOn = True
   theMessage = theMessage + "Front Yard, "   

else:
   isLightsOn = False


because you set the initial value of isLightsOn to True rather than False.

You should just set it to False at the top and remove the else clause at the bottom, because what you're shooting for is that the value be True if any of the above tests are true (any of the devices are on).

Then, the last part of the script becomes:

Code: Select all
if isLightsOn == False:
   theMessage = "All Lights Are Off"
   indigo.server.log(theMessage)
   indigo.actionGroup.execute(948838716) # Closeout Script
else:
   theMessage = "Lights are still on. Check " + theMessage
   indigo.server.log(theMessage)
   indigo.variable.updateValue(1862150451, theMessage) # send_alexa_variable


Or, even better:

Code: Select all
if isLightsOn:
   theMessage = "Lights are still on. Check " + theMessage
   indigo.server.log(theMessage)
   indigo.variable.updateValue(1862150451, theMessage) # send_alexa_variable
else:
   theMessage = "All Lights Are Off"
   indigo.server.log(theMessage)
   indigo.actionGroup.execute(948838716) # Closeout Script

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Feb 16, 2023 2:03 pm
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Touch URLs Devices, Variables, Folders?

jay (support) wrote:
You have a little buglet: your script will only set isLightsOn to False when the last if condition is False:


Gotcha. Thanks Jay! That will clean up my final code quite a bit. I must of realized an error at some point... because I had removed the else statement and started with a False statement.... sorta.

I deleted a bunch of devices before posting to keep this short.... But yes, I could change line 2 to True, delete lines 4-7 (4-22 in the actual script), flip the last two 'if's, then change the last 'if' to else. Learning all the time. (To make it confusing for anyone following this thread... between my initial script and this one I inverted the variable. isLightOn = True to allLightsOff = False.) My dumb ass probably thought if I switched it up, it would fix it... who knows.
Code: Select all
lCheckMessage = ""
allLightsOff = False

if indigo.devices[937130354].onState is False \
and indigo.devices[1633673098].onState is False \
and indigo.devices[571187066].onState is False:
   allLightsOff = True

if indigo.devices[937130354].onState is True:   
   lCheckMessage = lCheckMessage + "Bill's Office, "

if indigo.devices[571187066].onState is True:
   lCheckMessage = lCheckMessage + "Bex's Room, "   
   
if allLightsOff == True:
   lCheckMessage = "Inside Lights Are Off."
   emojiLights = emojiDash

if allLightsOff == False:
   lCheckMessage = "Inside Lights Are On: " + lCheckMessage
   emojiLights = emojiCouch


The emoji variables are called earlier in the script...."Couch" because there is only one lightbulb and then there is a couch with a lamp next to it.... I needed an emoji for outside and another for inside lights. If your couch is in the backyard, by all means, switch it up.
Code: Select all
emojiDash = "&#10134"
emojiCouch = "&#128715"

Bill
My Plugin: My People

Posted on
Thu Feb 16, 2023 2:49 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Touch URLs Devices, Variables, Folders?

That's less efficient than your previous approach, because you are now getting the device from the server twice... :P

And, your logic is wrong - you want or rather than and because any one of the being on will generate a different response than all of them being off.

Here's my version:

Code: Select all
lCheckMessage = "Inside Lights Are On: "
# Start from the assumption that all lights are off until proven otherwise
allLightsOff = True

if indigo.devices[937130354].onState is True:   
    # Found one that's on, add to the message and set allLightsOff to False
    lCheckMessage += "Bill's Office, "
    allLightsOff = False
if indigo.devices[571187066].onState is True:
    lCheckMessage += "Bex's Room, "   
    allLightsOff = False
#
# Repeat for each one
#
if allLightsOff:
    # All lights are off, message appropriately
    lCheckMessage = "Inside Lights Are Off."
    emojiLights = emojiDash
else:
    # At least one light is on, but you've been building the string of lights that are on, so no more to do
    emojiLights = emojiCouch

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Feb 16, 2023 3:12 pm
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Touch URLs Devices, Variables, Folders?

jay (support) wrote:
Here's my version:...


so...
myMessage = "Something to say"
myMessage = myMessage + "new thing to say"
<same>
myMessage = "Something to say"
myMessage += "new thing to say"
Mind Blown! I had no idea.

and...
if allLightsOff:
<same>
if allLightsOff == True:

If you don't specify ==True or ==False, it only returnsTrue?

Bill
My Plugin: My People

Posted on
Fri Feb 17, 2023 8:53 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Touch URLs Devices, Variables, Folders?

whmoorejr wrote:
If you don't specify ==True or ==False, it only returnsTrue?


In Python, any variable can be evaluated for "truthiness" - that is, when you use a variable by itself as any kind of test, then Python attempts to evaluate it as either True or False. In this specific case, the variable allLightsOff is specifically set to the values True or False (booleans), so the evaluation is clear. When you say:

Code: Select all
if allLightsOff:
    # This code will execute if allLightsOff is True
else:
    # This code will execute if it's False


then Python evaluates that variable to either True or False, and because in your script the variable is always one or the other, then it's clear (so no need to for the ==True part).

If you wanted to test to see if it's False, you could use ==False, or you could use the keyword not to negate the test itself:

Code: Select all
if not allLightsOff:
    # This code will execute if allLightsOff is False
else:
    # This code will execute if it's True


As I said, all Python variables can be evaluated for truthiness. For instance, the string "This is a string" will evaluate to True, while the empty string "" will evaluate to False. The number 0 will evaluate as False, and any other number will evaluate to True. The None keyword evaluates to False as well.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests