Anonymous functions - resoai/TileBoard GitHub Wiki

For many tile fields, like title, subtitle, state, icon, icons, filter, bg, filter, etc, you may use anonymous functions.

Mostly it will call with two arguments item and entity. First one is the config's object (tile) and the second one is HA's entity.

Also every function will called with custom context (this). It will have next fields:

{
   states: Object, // object of HA's entities {entityId: entity}
   $scope: Object, // angular's scope
   parseFieldValue: function (string, item, entity) // function for strings parsing 
}

Example of usage:

{
   position: [0, 0],
   id: "...",
   title: function (item, entity) {
      // this.parseFieldValue("@attributes.friendly_name", item, entity);
      return "Prefix: " + entity.attributes.friendly_name;
   }
}