Help Customizing Dashboard

I would like to customize this dashboard so the color of the battery level tiles change color from green for like if batteries were> 60%, yellow 40-59%, and red <40%. I'd like to just use the default dashboard app if possible. Is this even possible?

This can be done. It takes 600 lines of custom JSON entries. But your in luck, I have been working on this project for smartly. You can see the color changing icon thread here. I will be closing the voting and finishing the code this weekend.

Once completed I can send it to you and you can add it manually. If your good at JSON adding/editing and don't want to wait I'll post a snip-it here and you can build out the rest. You must have 1 JSON entry for EVERY state value or it will revert to default when it hits a missing value. Your color changes levels are going to be higher than ours so you will need to make changes either way.

In the sample below you can see I'm not only changing the tile color but icon color from black to white as well. These go it the JSON under "customColors": [ . Always make a backup!

 {
      "template": "battery",
      "bgColor": "rgba(0,255,105,0.75)",
      "iconColor": "rgba(0,0,0,0.66)",
      "state": "99"
    },
    {
      "template": "battery",
      "bgColor": "rgba(0,255,105,0.75)",
      "iconColor": "rgba(0,0,0,0.66)",
      "state": "100"
    },
    {
      "template": "battery",
      "bgColor": "rgba(251,104,12,0.9)",
      "iconColor": "rgb(255,255,255)",
      "state": "16"
    },
    {
      "template": "battery",
      "bgColor": "rgba(255,0,0,0.65)",
      "iconColor": "rgb(255,255,255)",
      "state": "15"
    },

4 Likes

In my opinion (FWIW) this is a crazy amount of customisation for something that must surely be barely a few lines of code in the original system if only Hubitat would add it. The system currently changes the color from green to red. How hard could it be to add the freaking yellow?!?

Thanks for your reply @TechMedX. I may give that a try. It does seem a bit more complicated than I hoped though. I have to agree though with @Angus_M- it would be nice if it was built in somehow. But you do have to appreciate the fact it IS possible though if you have the ingenuity.

@Angus_M @magasser That's nothing compared to what it took to control the temp color changes (but they look really cool! see below). Once they are all completed it's just be a matter of copying and pasting. Not driver then adding a custom app/driver with thousands of lines and child multiple child apps.

I use excel to make the changes quick, and easy with auto fill. It makes changing hundreds of lines of code just a "drag and drop" process. Again I would not consider myself a true coder or dev, so you can laugh at my techniques, but they work for me (happy to hear of other programs for mass edits).

Besides how do we know HE does not need to do the same coding for the hub? Heck if they want they are welcome to add mine!

1 Like

While I applaud your creativity and fortitude to work this all out (it must have taken hours!), in my opinion we are kinda sticking a plaster over a dashboard system that would really benefit from improvements at its core. I really hope that gets done soon. In the meantime I've gone the route of building a completely bespoke dashboard hooked in with eventsocket and Maker API. That is also a huge stack of work with the only upside being I've learned a heck of a lot and am at last near to getting something really cool without the constraint of blocks of tiles. So mate, I applaud you for your work and I know a lot of people are using it and finding it very beneficial, which is great.

1 Like

Thank you for the kind words. I have often been tempted to setup one of the many "off hub" dashboard solutions. However my motivation is slightly self-severing. I run a mom and pop shop which resells/deploys/maintains computers/home theater/audio/automation. As such I want a "self contained" deployment option.

While this project has taken a couple hours (maybe 2-3 hours total over two weeks, and that includes temps and humidity), now that it is done I can replicate it 9872523456 times with very little additional effort/cost/equipment/time. For me the "long way" is much shorter "long term" with a higher ROI.

Our goal at smartly is that HE will develop a dashboard system that crashes smartly and thus we no longer have to do any of this. Alas until that day comes, if I want to sell something that looks respectable, I will continue to help @spelcheck improve what is a fantastic "on hub" solution IMO.

1 Like

@Angus_M in case you doubt the speed of excel coding here is about 250 lines (once JSON repositions them) done in 30seconds.

Add this macro to excel

    Dim r As Range, c As Range
    Dim sTemp As String

    Open "c:\Temp\MyOutput.txt" For Output As #1
    For Each r In Selection.Rows
        sTemp = ""
        For Each c In r.Cells
            sTemp = sTemp & c.Text & Chr(9)
        Next c

        'Get rid of trailing tabs
        While Right(sTemp, 1) = Chr(9)
            sTemp = Left(sTemp, Len(sTemp) - 1)
        Wend
        Print #1, sTemp
    Next r
    Close #1

highlight the fields you want to export and it saves the content to a .txt file :wink: done!

1 Like

Cool indeed!

This is the latest thread I can find that references battery percentage and tile color. My smoke detector started beeping at 77% (in the middle of the night, of course), so I really would like to make that tile yellow at 80%. Maybe all the tiles should be yellow at 80%, but I cannot figure out how to easily do that.

Has any feature been added since this thread that makes it easier to control tile color in relation to values represented in the tiles?

Thanks!