TileBoard - New dashboard for Homeassistant

I now see that the [0].map basically says, for each item in the list (in this case one with a value of 0), do whatever is in the function.

I then thought, maybe just return a list of objects…

 list: function() {
                        let myList = [];
                        const icon = 'mdi-school';
                        for (i = 1; i <= 3; i++) {
                           myList.push({
                              title: 'Test ' + i,
                              icon: icon,
                              value: 'Value ' + i
                           })
                        }
                        console.log(myList);
                        return myList;
                     }),

In this case though, list is still empty, console doesn’t log which tells me the function isn’t running?

I’m such a massive fan of Tileboard, I have to say. Been using it for ages!

However, I am a bit stuck. Does anyone know how to use a TYPES.SCRIPT object to call a Home Assistant script that accepts parameters…and how to pass those parameters to the script?

Answered my own question. For anyone else who is wondering, I used TYPES.CUSTOM and then used Api.send.

It appears all my issues (hanging, crashing, blue screen) were due to the camera. I changed the refresh from the math function to 1500, but then it refreshes too much and while it is refreshing it creates a big blue box where the camera is. if I set it to 0, it is good, but obviously never refreshes. Someone defeats the point of the camera.

If I make the camera type camera_stream, nothing shows up but a blue box. I am currently using the streaming function of motion eye. Any tips? Who has a good working camera tile? Here is my tile.

// GARAGE CAM \\
                {
                    position: [2.5, 2],
                    id: 'camera.garageme',
                    title: '',
                    type: TYPES.CAMERA,
                    bgSize: 'cover',
                    width: 3.5,
                    height: 2,
                    state: false,
                    fullscreen: {
                        type: TYPES.CAMERA_STREAM,
                        objFit: 'contain',
                        id: 'camera.garageme',  // Optional: camera entity to use on fullscreen, defaults to the tile camera entity if omitted
                        bufferLength: 5  // Optional: buffer length in seconds for the HLS buffer, default is 5 seconds
                    },
                    refresh: 2000,
                  },

CAMERA_STREAM is only for cameras that use stream component in HA. I’m not sure, but I believe motionEye outputs MJPEG? Try this:

      type: TYPES.CAMERA,
      ...
      refresh: 0,
      filter: function (item, entity) {
         return entity.attributes.entity_picture.replace('/camera_proxy/', '/camera_proxy_stream/');
      },
      bgSize: 'cover'

This should output MJPEG stream from HA, however you should not do this if you have more than one camera on the page as HA begins to throttle and eventually closes the connection. You can also use the very same technique to bypass HA and use MJPEG stream directly from MotionEye:

      type: TYPES.CAMERA,
      id: {},
      refresh: 0,
      filter: function (item, entity) {
         return 'http://motioneye-address/stream-path';
      },
      bgSize: 'cover'

In this case you might also need to provide username/password in the URL if MotionEye needs it, but be careful not to expose TileBoard via internet as your camera credentials will then be leaked.

1 Like
        list: (function() {
             l = [];
             for (i = 1; i < 4; i++) {
                 l.push({
                     title: 'Title ' + i,
                     icon: 'mdi-school',
                     value: 'Value ' + i
                 });
             }
             return l;
        })(),

Please use this.apiRequest({}); rather than Api.send({});.

Hi all

I have a little problem with an iframe tile and browser caching. So I use said iframe tile to display a timeline of security events along with image snapshots of every event. This timeline is an external HTML file which is autogenerated by a shell command everytime a security event occurs (through a HA automation). The problem is that the browser will cache the HTML in the iframe. So I used the usual random number suffix added after the url:

type: TYPES.IFRAME,
id: { },
url: function() { return 'URLGOESHERE.html?v=' + Math.ceil(Math.random() * 100); }

This leads to a huge and humanly unreadable Angular error. However, if you ignore the humongeous error message, it actually works. The html is correctly reloaded in the iframe. There’s just, well, a huge red fullscreen sized error popping up :slightly_smiling_face:

If I remove the randomness and just add a fixed suffix (like ?v=1234, for example), the error goes away, but the browser caches it again.

Any ideas ?

Thanks !

Fully kiosk had an api, I call the api to show a camera when my gates open and then load tile board back afterwards. You could create a button in ha/tileboard to call the fully kiosk api to set the url to load.

Replying to myself here, I fixed it. Well, kinda. I still don’t know where the error came from, but the approach itself was flawed. I now use a global suffix variable, defaulting to Date.now(), which is updated by the HA automation that also generates the html displayed in the iframe. This is done using a tileboard event fired by the automation. Which in turn updates the suffix and that in turn triggers a reload of the newly generated html in the iframe tile. Works really well.

So just in case someone else has a problem like that, this is how the iframe tile looks like now:

{
    position: [0, 0.4],
    type: TYPES.IFRAME,
    id: { },
    width: 3,
    height: 4.2,
    url: function() {
        return 'url_to_the_generated_thingies/eventline.html?v=' + eventLineSuffix;
    }
}

And this is the event handler:

events: [
    {
        command: 'refresh_eventline',
        action: function(e) {
            eventLineSuffix = Date.now();
        }
    }
]

HA fires a tileboard/refresh_eventline event when the eventline.html was regenerated.

Looks like this on my phone:

Pretty awesome what you can do with Tileboard :grinning:

2 Likes

Sorry for hijacking thread but im trying to get a tile to work that displays number of lights that are on.

here is the code:

{
position: [1, 0],
type: TYPES.CUSTOM,
id: {},
subtitle: ‘Lampor’,
title: ‘Uppe’,
action: function(e) {
window.openPage(CONFIG.pages[1]);
},
icons: function() {
//replace kitchen1, kitchen2, kitchen3 with the names of your lights in the particular room
var lights = ["&light.hall1.state", “&light.hall2.state”, “&light.sovrum1.state”];
//designate a counter variable
var count = 0;

//loop through the array of lights
for (i = 0; i < lights.length; i++) {
  if (this.parseFieldValue(lights[i]) === "on") {
    //increment the counter by 1 if the given light is on
    count++;
  }
}
//return the number of lights that are on
switch (count) {
  case 1:
    return "mdi-numeric-one-circle-outline";
  case 2:
    return "mdi-numeric-two-circle-outline";
  case 3:
    return "mdi-numeric-three-circle-outline";
  case 4:
    return "mdi-numeric-four-circle-outline";
  default:
    return "mdi-numeric-zero-circle-outline";
}

}
},

tile

I cant get it to work.

icons: -> icon:

Ive changed icon naming to:

}
//return the number of lights that are on
switch (count) {
case 1:
return “mdi-numeric-1-circle-outline”;
case 2:
return “mdi-numeric-2-circle-outline”;
case 3:
return “mdi-numeric-3-circle-outline”;
case 4:
return “mdi-numeric-4-circle-outline”;
default:
return “mdi-numeric-0-circle-outline”;
}
}
},

and now i can see a 0 in my tile but it doesnt count if I light a lightswitch.
Im sorry of my lack of knowledge.

ok, ive figured it out, it needed the entityid not the entity name. sorry for all my posts but it seemed like i needed to think outloud somewhere. :blush:

Did you figured it out? I need that also.

right now on my tiles i have history enabled by default on long-press (secondaryAction), how can i use the history pop-up on first action (single press)
thanks

1 Like

Is it possible to not show error messages? Like this ones:
image

Thanks

ignoreErrors: true

Hi @resoai,
is it possible to have tile that has an “camera” icon and if I click on that the camera _stream tab shows up? Currently I have more than one camera and I would like to show them up using just a single tile with a camera icon.

{
    position: [0, 2],
    width: 2,
    height: 1,
    title: 'Kameras',
    id: {},
    type: TYPES.CUSTOM,
    state: false,
    icon: 'mdi-camera',
    filter: function (item, entity) {
        return 'http://homeassistant.fritz.box:8801';
    },
    fullscreen: {
        type: TYPES.CAMERA,
        objFit: 'contain',
        id: 'camera.wohnzimmer',
        refresh: 1500
    }
}

Something like this but this is not working.

Thanks

Thank you :slight_smile: