need help design the custom image names

Posted on
Tue Jan 17, 2017 9:52 pm
kw123 offline
User avatar
Posts: 4891
Joined: May 12, 2013
Location: dallas, tx

need help design the custom image names

there is a device/state that can be
-1/0/1/2/3/4/5/6/7/8/9

I have a drawing of my house and would like to have a green dot in
room 0 when state=0,
room 1 when state=1,
room 2 when state=2,
room 3 when state=3,
room 4 when state=4,
...
room 9 when state=9,
and blank otherwise in each room


The only way I have found to do this is to have 11 images per room (=10*11 = 110 images) There should be an easier way

currently i have blank images for room 5
r5+-1.png
r5+0.png
r5+1.png
r5+2.png
r5+3.png
r5+4.png
not r5+5.png
r5+6.png
r5+7.png
r5+8.png
r5+9.png
and ONE green dot
r5+5.png
and that for each room (x=0...9,y=-1...-9) rx+y.png

is there an easier way to do this?
if I leave blank images out the algorithm tries to find a closets image and that might be a green dot.


Karl

Posted on
Tue Jan 17, 2017 10:36 pm
ckeyes888 offline
Posts: 1838
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: need help design the custom image names

Not sure if I really get what you're after but I reference the same set of images from any number
of variables, device states etc.
If it's just a green dot, or not, for all the rooms I would think one set of images would cover it.

Carl

Posted on
Tue Jan 17, 2017 11:21 pm
kw123 offline
User avatar
Posts: 4891
Joined: May 12, 2013
Location: dallas, tx

Re: need help design the custom image names

i tried that, but if the state is not available as image Indigo will try to find an image name that is close - and that might be the green dot.
I created the 110 images and it works... but I am not happy with it ..


there are actually 10x10 combinations (you have to add the default name xx+.png too which makes it 11x10 images)

--- see the post http://forums.indigodomo.com/viewtopic.php?f=187&t=17846


Karl

Posted on
Wed Jan 18, 2017 4:26 am
DaveL17 offline
User avatar
Posts: 3403
Joined: Aug 20, 2013

Re: need help design the custom image names

Why not have 10 variables (one for each room), two images per room (on and off), and then use a script to manage the variable values?

EDIT - you'd only need two images. 10 variables and 2 images

Posted on
Wed Jan 18, 2017 8:07 am
autolog offline
Posts: 2003
Joined: Sep 10, 2013
Location: West Sussex

Re: need help design the custom image names

I don't think you need a script, just use a two triggers (Device State Changed) for each room to set the room's variable e.g.. Becomes Equal To to value and becomes Not Equal To value.
The idea to use a variable is good :)

Posted on
Wed Jan 18, 2017 8:27 am
kw123 offline
User avatar
Posts: 4891
Joined: May 12, 2013
Location: dallas, tx

Re: need help design the custom image names

So for 10 beacons I would need 10times 10 variables ...

I guess you have to bite the bullet one way or the other

Already created the png files. And it is working.

Also looked at the indigoulitily.py file that is mentioned in the docu. But that would mean to change indigo and keep it up to date every time it gets updated.

Anyway thanks for the suggestions.


Sent from my iPhone using Tapatalk

Posted on
Wed Jan 18, 2017 8:38 am
autolog offline
Posts: 2003
Joined: Sep 10, 2013
Location: West Sussex

Re: need help design the custom image names

No you need one variable per room.

Lets take Room '0' as an example:
Set trigger 1 for Room '0' to if device State Changed becomes equal to '0', set room '0' variable to true
Set trigger 2 for Room '0' to if device State Changed becomes not equal to '0', set room '0' variable to false
Set your green dot images to be based on True/False

Repeat for room '1' e.g.:
Set trigger 1 for Room '1' to if device State Changed becomes equal to '1', set room '1' variable to true
Set trigger 2 for Room '1' to if device State Changed becomes not equal to '1', set room '1' variable to false

Should work, I think. :)

Posted on
Wed Jan 18, 2017 9:06 am
DaveL17 offline
User avatar
Posts: 3403
Joined: Aug 20, 2013

Re: need help design the custom image names

Maybe I'm oversimplifying, but why not just do this:

10 variables, 1 per room
2 images, image+.png, image+on.png
trigger on device state changes to run script
script reads dev state and sets corresponding room variable to on, all others set to off

Something like this:
Code: Select all
rooms = {'variable ID room 1': 1, 'variable ID room 2': 2, 'variable ID room 3': 3}  # dict of rooms/state values
state = 2  # read the device state and set to int

for k,v in rooms.items():
    if v == state:
        indigo.variables.updateValue(k, 'on')
    else:
        indigo.variables.updateValue(k, 'off')

Posted on
Wed Jan 18, 2017 9:26 am
kw123 offline
User avatar
Posts: 4891
Joined: May 12, 2013
Location: dallas, tx

Re: need help design the custom image names

Then multiply with number of beacons..

I can add the variable management to the plugin:
beaconXroomY = 0/1
that would then create X times Y times 2 variables?
in my case 35 times 10 = 350 variables

Using images path it is 11 images per 10 room it is 110 images for one beacon or 1000 beacons

I guess the crossing point is 6 beacons (10x11) =110 with variables and 110 with image method

it would be much easier if indigo would have a switch: don't do fancy interpolation(*): if value found use ON if not OFF image. That would require
r0+.png = empty
r0+on.pgn= image
r1+.png
r2+on.png
= 20 images

Karl

this is the indigo code that should NOT be executed:
Code: Select all
         if isIntCompat(value):
            intValue = int(value)
            if intValue == 0:            # case a)
               return fullPath
            stepPath = fullPathNoExt + u"+" + str(GetNextIntegerStep(intValue, 5)) + fileExt
            if os.path.exists(stepPath):   # case b)
               return stepPath
            stepPath = fullPathNoExt + u"+" + str(GetNextIntegerStep(intValue, 10)) + fileExt
            if os.path.exists(stepPath):   # case c)
               return stepPath
            stepPath = fullPathNoExt + u"+" + str(GetNextIntegerStep(intValue, 20)) + fileExt
            if os.path.exists(stepPath):   # case d)
               return stepPath
            stepPath = fullPathNoExt + u"+" + str(GetNextIntegerStep(intValue, 25)) + fileExt
            if os.path.exists(stepPath):   # case e)
               return stepPath


it will find something for rooms 0...4 by adding 5 to the value and try again.. ... not for rooms 5...9

Posted on
Wed Jan 18, 2017 9:47 am
DaveL17 offline
User avatar
Posts: 3403
Joined: Aug 20, 2013

Re: need help design the custom image names

I'm afraid I don't know from beacons. Sorry.

I was reacting to:
there is a device/state that can be
-1/0/1/2/3/4/5/6/7/8/9

I have a drawing of my house and would like to have a green dot in
room 0 when state=0,
room 1 when state=1,
room 2 when state=2,
room 3 when state=3,
room 4 when state=4,
...
room 9 when state=9,
and blank otherwise in each room


So I saw 1 device and 10 rooms.

Posted on
Wed Jan 18, 2017 9:56 am
autolog offline
Posts: 2003
Joined: Sep 10, 2013
Location: West Sussex

Re: need help design the custom image names

DaveL17 wrote:
... So I saw 1 device and 10 rooms.

ditto :D

Posted on
Wed Jan 18, 2017 11:18 am
kw123 offline
User avatar
Posts: 4891
Joined: May 12, 2013
Location: dallas, tx

Re: need help design the custom image names

if I create a state that is not an integer it should work!

room= "room:4" or something else
then the indigo fancy search does not kick in and it can only use either the exact file name of the default/fallback!!!

==> 2 images per room for all beacons

r4+.png = empty if something else
r4+room:4.png = green dot if =="room:4"

Karl

Posted on
Wed Jan 18, 2017 11:33 am
johnpolasek offline
Posts: 738
Joined: Aug 05, 2011
Location: Aggieland, Texas

Re: need help design the custom image names

Technically, shouldn't it be "rPi X" rather than "Room X" until and unless you can get the distancing not only working reliably but somehow tied to an actual floor plan? Personally I have my doubts that signal strength correlated with distance will ever be reliable given the issues of walls and signal reflective surfaces and open and closed doors, etc, but strongest signal == closest Pi ought to be a pretty good indicator,,,

Posted on
Wed Jan 18, 2017 11:44 am
kw123 offline
User avatar
Posts: 4891
Joined: May 12, 2013
Location: dallas, tx

Re: need help design the custom image names

yes that works but not with a ":" in the name OS X does not like : in file names

so the solution that seems to work

create a device/state or variable:
clostestRPItext has values = closesetRPI= -1/0/12/3/4/5/6/7/8/9 (eg " closesetRPI=5"

create image files
r0+.png = empty
r0+closestRPI=0.png == green dot
r1+.png
r1+closestRPI=1.png
..
r9+.png
r9+closestRPI=9.png
= 20 images

then for each beacon create one item in control page per room with "As image" = rX+.png where x = 0.../9 for each room.


Karl
... there is always a solution ...

Posted on
Wed Jan 18, 2017 12:05 pm
kw123 offline
User avatar
Posts: 4891
Joined: May 12, 2013
Location: dallas, tx

Re: need help design the custom image names

and even better:
use 2 items to display

1. a semi transparent rectangle
2. text for the beacon
overlay both with the image on top.
then
r0+.png contains the rectangle
r0+closestRPI=0.png is the empty image
then it looks like:
Screen Shot 2017-01-18 at 12.02.07.png
Screen Shot 2017-01-18 at 12.02.07.png (8.63 KiB) Viewed 985 times
.
when the beacon is present you can see the text here volvo key 1 /2 and when it is not present you see the rectangle and the text is a little bit visible. you could make the image non transparent with same color as background then
beacon present == text
beacon not present == background

Karl

Who is online

Users browsing this forum: No registered users and 1 guest