Page 1 of 2

Can control page text change color based on a value?

PostPosted: Thu May 20, 2021 8:26 am
by norcoscia
Hi, my ability to keep the Netatmo IOS app running on my old IPAD display has finally ended so I built a quick control page (thank goodness for Indigo IOS app).

I’m displaying various values that are pulled from Netatmo and wondering if I can change the color of the text based on the Netatmo value.

Example - Netatmo C02 value becomes greater than 900 parts per million - I would like to change the color of the text displaying the value to red (flashing would be nice but I’m sure that is not do-able).

Is this possible without creating Python code?

Thanks for any help!!!!!!

Re: Can control page text change color based on a value?

PostPosted: Thu May 20, 2021 1:49 pm
by matt (support)
Unfortunately, you cannot currently dynamically change the text color. You could try creating a couple of background images, one perhaps transparent and the other solid red, then place that behind the device state control. You would name the images something like:

Code: Select all
background_alert+.png
background_alert+red.png

then you could set them to reflect a variable value that you would alternate between having a value of an empty string and the string "red".

Re: Can control page text change color based on a value?

PostPosted: Thu May 20, 2021 2:12 pm
by norcoscia
OK, thanks Matt - background is a good idea. I was just hoping it would be easy since I’m getting lazy in my older age :-)

Re: Can control page text change color based on a value?

PostPosted: Wed Jul 27, 2022 5:42 pm
by SearchCz
I dont know the Netatmo, but let's say that the CO2 level is a device state. You could display that device state on a control page in a subtle color, and ALSO display a variable of your creation that shows the same value in red, in the same spot as the other text, but higher in the z-order.

To make it work, you would set up a trigger to stuff the device state into your red text variable whenever the CO2 level rises above the ppm of concern. Also, another trigger so that, when the Co2 drops, you stick an empty (or blank) string into that same red text variable. When the variable is empty, the underlying text will show through. When the variable has content, it will be seen since it is higher in the z-order.

Check this video, showing two control pages side-by-side. The one on the right is a dynamic *list* of the on devices in my home. When I toggle a device off, I put the name of the device into the "offCaption" variable to get the white on black effect (rather than black on white).

https://www.youtube.com/watch?v=uGll0rOj1BM

Re: Can control page text change color based on a value?

PostPosted: Wed Jul 27, 2022 5:49 pm
by norcoscia
Thanks I’ll check it out!

Re: Can control page text change color based on a value?

PostPosted: Thu Jul 28, 2022 6:01 am
by DaveL17
I like @SearchCz's approach very much -- but for simple things, like instances where the possible text values and color combinations are finite, I typically use Matt's approach to create simple PNGs with the values and colors I want to use. Where the possible text values are "infinite", I will usually use Python to create (and recreate) images on the fly using Matplotlib, Gnuplot, Pillow or something similar.

Here's a post that references a couple different approaches.

Re: Can control page text change color based on a value?

PostPosted: Fri Jul 29, 2022 8:19 pm
by SearchCz
I’m over the moon just to have a control page that shows everything that is on. Something turns on, it gets added. I don’t have to scan or sift through 100 devices to locate the 12 that are on. I actually kind of surprised myself when I was able to make it work out …. a dynamic control page that only shows “on” devices, and adds devices as they are turned on. I’m a little bit proud of that.

Re: Can control page text change color based on a value?

PostPosted: Fri Jul 29, 2022 8:34 pm
by ryanbuckner
SearchCz wrote:
I’m over the moon just to have a control page that shows everything that is on. Something turns on, it gets added. I don’t have to scan or sift through 100 devices to locate the 12 that are on. I actually kind of surprised myself when I was able to make it work out …. a dynamic control page that only shows “on” devices, and adds devices as they are turned on. I’m a little bit proud of that.


Share a screen shot of this ?

Re: Can control page text change color based on a value?

PostPosted: Sat Jul 30, 2022 1:02 pm
by SearchCz
ryanbuckner wrote:
SearchCz wrote:
I’m over the moon just to have a control page that shows everything that is on. Something turns on, it gets added. I don’t have to scan or sift through 100 devices to locate the 12 that are on. I actually kind of surprised myself when I was able to make it work out …. a dynamic control page that only shows “on” devices, and adds devices as they are turned on. I’m a little bit proud of that.


Share a screen shot of this ?


Happy to share a few screen shots, These show my home with just a few things turned on. Then, as additional items are turned on, they get *added* to the collection. A tap on any item will toggle it. I don’t take away the items when they are turned off, but I have the *refresh* and *compress* options to bring the collection back to only showing devices that are currently on.

F108C047-F3BC-41B8-9F5B-3B76E59D0CB9.jpeg
My house with a few items turned on
F108C047-F3BC-41B8-9F5B-3B76E59D0CB9.jpeg (82.4 KiB) Viewed 2344 times


9AD22143-37A4-45F6-AE36-19F657BD235F.jpeg
Lobby Mood gets turned off
9AD22143-37A4-45F6-AE36-19F657BD235F.jpeg (81.58 KiB) Viewed 2344 times


C41799AA-9162-4FF7-8831-5FEB552843C8.jpeg
Fireplace turns on, so it gets added to the collection
C41799AA-9162-4FF7-8831-5FEB552843C8.jpeg (90.81 KiB) Viewed 2344 times


588F8D6A-62DF-43E6-AC73-C9B6897DC372.jpeg
Assortment of devices that are (or recently were) turned on
588F8D6A-62DF-43E6-AC73-C9B6897DC372.jpeg (98.7 KiB) Viewed 2344 times


These are all the same singular control page, changing as the status of devices in the home changes.

Re: Can control page text change color based on a value?

PostPosted: Sat Jul 30, 2022 1:13 pm
by SearchCz
ryanbuckner wrote:
SearchCz wrote:
I’m over the moon just to have a control page that shows everything that is on. Something turns on, it gets added. I don’t have to scan or sift through 100 devices to locate the 12 that are on. I actually kind of surprised myself when I was able to make it work out …. a dynamic control page that only shows “on” devices, and adds devices as they are turned on. I’m a little bit proud of that.


Share a screen shot of this ?


Maybe the video will give you a better sense of what the control page does?

https://youtu.be/mDxNLLggKkU

Re: Can control page text change color based on a value?

PostPosted: Sat Jul 30, 2022 2:09 pm
by norcoscia
Really nice work on your control pages!!!!!

Re: Can control page text change color based on a value?

PostPosted: Sat Jul 30, 2022 5:44 pm
by SearchCz
norcoscia wrote:
Really nice work on your control pages!!!!!


Thanks! I still have the odd weirdo device pop up from time to time. Virtual devices that are remnants of past experiments.. might be purge unneeded devices, but that delete button scares me!

Re: Can control page text change color based on a value?

PostPosted: Sun Jul 31, 2022 5:50 am
by SearchCz
DaveL17 wrote:
I like @SearchCz's approach very much -- but for simple things, like instances where the possible text values and color combinations are finite, I typically use Matt's approach to create simple PNGs with the values and colors I want to use. Where the possible text values are "infinite", I will usually use Python to create (and recreate) images on the fly using Matplotlib, Gnuplot, Pillow or something similar.

Here's a post that references a couple different approaches.


My text values are extra Ed fro the devices and placed into variables via Python. I think that makes it well suited to “infinite” possible values?

Re: Can control page text change color based on a value?

PostPosted: Sun Jul 31, 2022 6:03 am
by DaveL17
SearchCz wrote:
My text values are extra Ed fro the devices and placed into variables via Python. I think that makes it well suited to “infinite” possible values?


The way I think about it, I think so. One of my links above shows how to create an image with scrolling text; might this be something that could be adapted to your situation? In other words, not scrolling--but flashing?

Re: Can control page text change color based on a value?

PostPosted: Mon Aug 01, 2022 11:19 am
by SearchCz
DaveL17 wrote:
SearchCz wrote:
My text values are extra Ed fro the devices and placed into variables via Python. I think that makes it well suited to “infinite” possible values?


The way I think about it, I think so. One of my links above shows how to create an image with scrolling text; might this be something that could be adapted to your situation? In other words, not scrolling--but flashing?


That sounds interesting …