Can control page text change color based on a value?

Posted on
Thu May 20, 2021 8:26 am
norcoscia offline
User avatar
Posts: 1206
Joined: Sep 09, 2015

Can control page text change color based on a value?

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!!!!!!

_______
Norm

Posted on
Thu May 20, 2021 1:49 pm
matt (support) offline
Site Admin
User avatar
Posts: 21416
Joined: Jan 27, 2003
Location: Texas

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

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".

Image

Posted on
Thu May 20, 2021 2:12 pm
norcoscia offline
User avatar
Posts: 1206
Joined: Sep 09, 2015

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

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 :-)

_______
Norm

Posted on
Wed Jul 27, 2022 5:42 pm
SearchCz offline
Posts: 172
Joined: Sep 18, 2019

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

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

Posted on
Wed Jul 27, 2022 5:49 pm
norcoscia offline
User avatar
Posts: 1206
Joined: Sep 09, 2015

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

Thanks I’ll check it out!

_______
Norm

Posted on
Thu Jul 28, 2022 6:01 am
DaveL17 offline
User avatar
Posts: 6751
Joined: Aug 20, 2013
Location: Chicago, IL, USA

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

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.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Fri Jul 29, 2022 8:19 pm
SearchCz offline
Posts: 172
Joined: Sep 18, 2019

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

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.

Posted on
Fri Jul 29, 2022 8:34 pm
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

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

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 ?

Posted on
Sat Jul 30, 2022 1:02 pm
SearchCz offline
Posts: 172
Joined: Sep 18, 2019

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

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 2226 times


9AD22143-37A4-45F6-AE36-19F657BD235F.jpeg
Lobby Mood gets turned off
9AD22143-37A4-45F6-AE36-19F657BD235F.jpeg (81.58 KiB) Viewed 2226 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 2226 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 2226 times


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

Posted on
Sat Jul 30, 2022 1:13 pm
SearchCz offline
Posts: 172
Joined: Sep 18, 2019

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

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

Posted on
Sat Jul 30, 2022 2:09 pm
norcoscia offline
User avatar
Posts: 1206
Joined: Sep 09, 2015

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

Really nice work on your control pages!!!!!

_______
Norm

Posted on
Sat Jul 30, 2022 5:44 pm
SearchCz offline
Posts: 172
Joined: Sep 18, 2019

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

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!

Posted on
Sun Jul 31, 2022 5:50 am
SearchCz offline
Posts: 172
Joined: Sep 18, 2019

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

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?

Posted on
Sun Jul 31, 2022 6:03 am
DaveL17 offline
User avatar
Posts: 6751
Joined: Aug 20, 2013
Location: Chicago, IL, USA

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

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?

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon Aug 01, 2022 11:19 am
SearchCz offline
Posts: 172
Joined: Sep 18, 2019

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

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 …

Who is online

Users browsing this forum: No registered users and 4 guests