Closed uros76 closed 1 year ago
Hey. glad you like.
you have the trigger entity as "states.lock.front_door_2.state" should just be lock.front_door_2
Oh boy, now I am ashamed of this tiny mistake 😒. It works of course, thanks a lot! 👍😊
No problem. Easy mistake to make.
@wonderslug I have another refresh related question.
The entity state change does get refreshed on the MM module but the relative time of last_updated does not get refreshed. Do I need to specify something extra to get the time of change refreshed on the MM? On the HA templating it works, relative time gets updated on it's own.
Here is the updated test code currently in use:
{
module: 'MMM-HomeAssistantDisplay',
position: 'bottom_center',
config: {
host: "192.168.1.226",
token: "hidden$
port: 8123,
title: "HA inputs",
sections: [{
triggerEntities: [
"lock.front_door_2"
],
displayTemplate: `
{%- if states.lock.front_door_2.state == "locked" -%}
{%- set icon = "home-lock" -%}
{%- set stateText = "Locked" -%}
{%- elif states.lock.front_door_2.state == "unlocked" -%}
{%- set icon = "home-lock-open" -%}
{%- set stateText = "Unlocked" -%}
{%- endif -%}
<i class='mdi mdi-{{icon}}'></i> Front door - {{stateText}} {{relative_time(states.lock.front_door_2.last_updated)}} ago
`,
}]
},
},
So the display template is fully rendered by Home Assistant itself. Im not sure whats going on with the last updated but you can check your displayTemplate using the Developer Tools Template renderer. You should be able to see exactly what the output of the display template is going to be.
Tried it and the relative time works correctly, it gets updated in the output. The icon doesn't get processed but that's normal for an alphanumerical renderer.
I might end up just using the fixed time of the last update state. Relative processed time somehow doesn't work 🤷♂️.
Hi. Thanks for a great module :).
I can see the HA sensor state displayed correctly but if the state changes this does not get updated on my MM. After I restart the MM the correct state shows up. Am I missing something or doing it wrong? 🤷♂️
Here is my module code in the MM config: