Read the statement by Michael Teeuw here.
Visibility of variables in MMM-HomeAssistantDisplay
-
this is the code, I would like if a fixed is closed (status false) that this is not displayed. Unfortunately this was not displayed in your link.
-
@DrKaMo said in Visibility of variables:
I would like if a fixed is closed (status false)
what is a ‘fixed’?
-
@sdetweil I only want to display the windows that are open. I have already tried this link but apparently my variable does not have the state bit but only the bit itself.
-
@DrKaMo I have a garage door that is a ‘cover’ type device
my config (copied from the sample )
let perimeterWindowSections = []; perimeterWindows.forEach((item, i) => { perimeterWindowSections.push({ triggerEntities: [ item.entity ], displayTemplate: ` {% if states.${item.entity}.state == "open" %}<i class='mdi mdi-window-open'></i> ${item.name}{% endif %} `, class: "window" }); });
and it changes immediately when the door is opened and closed…
if I change entity state === ‘closed’ then it shows(as it IS closed) when closed , and not if its ‘open’
the module config itself
{ module: 'MMM-HomeAssistantDisplay', position: 'top_right', classes:"page2", config: { host: "xxx", token: "..", port: 8123, useTLS: false, title: "Open Windows", useModuleTigger: false, class: "windows", sections: [ ...perimeterWindowSections, ] }, },
I also used a light switch
{% if states.${item.entity}.state == "on" %}<i class='mdi mdi-window-open'></i> ${item.name}{% endif %}
and it worked as expected, and the MM display responded immediately
so it looks like just getting the entity state value is what you need
if the entity is a switch , the states are on and off
if the entity is a cover, then the states are open and closed
and I checked with a binary sensor{ entity: "binary_sensor.athom_garage_door_status", name:"fooo" }
and it is on or off
-
@DrKaMo did you resolve this?