This repository has been archived by the owner on Nov 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 278
Anonymous functions
Evgeny edited this page Jul 9, 2018
·
2 revisions
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;
}
}