wonderslug / MMM-HomeAssistantDisplay

A Magic Mirror Module to display information from Home Assistant.
MIT License
83 stars 6 forks source link

Which homeassistant module are you using #1

Closed polzy closed 2 years ago

polzy commented 2 years ago

Which homeassistant's module are you using ?

I have this module : https://github.com/bruxy70/Garbage-Collection but I can not configure it with MMM-HomeAssistantDisplay

Value Meaning
0 Collection is today
1 Collection is tomorrow
2 Collection is later

i have try this :

   title: "Poubelles",              
   useModuleTigger: false,
    moduleTriggerTemplate: `{{ states.sensor.carton.state == "0"}}`,
    moduleTriggerEntities: ["binary_sensor.carton"],
    class: "garbage_collection.collect_garbage",
    sections: [{
        triggerEntities: [
            "sensor.poubelle",
            "sensor.carton"
        ],
        displayTemplate: `
            {% if states.sensor.poubelle.state == "0" %}<i class='mdi mdi-trash-can'></i>{% endif %}
            {% if states.sensor.carton.state == "0" %}<i class='mdi mdi-recycle'></i>{% endif %}
            `,
        class: "put-outs"
wonderslug commented 2 years ago

Howdy,

For me personally I am using the Google Calendar integration to get my local pickup schedule and then I setup a binary_sensor base on events.

For what your doing I would convert the states to integers and compare that way.

{% if states.sensor.poubelle.state|int == 0 %}<i class='mdi mdi-trash-can'></i>{% endif %}
{% if states.sensor.carton.state|int == 0 %}<i class='mdi mdi-recycle'></i>{% endif %}

Make sure you check your template in the Home Assistant Template Editor. The module will display whatever the same output from that would be. It uses the same template rendering function of HA.

polzy commented 2 years ago

thanks you so much, it works

    title: "Poubelles",             
   useModuleTigger: false,
    moduleTriggerTemplate: `{{ states.sensor.carton.state == "1"}}`,
    moduleTriggerEntities: ["garbage_collection.collect_garbage"],
    class: "garbage_collection.collect_garbage",
    sections: [{
        triggerEntities: [
            "sensor.poubelle",
            "sensor.carton"
        ],
        displayTemplate: `
            {% if states.sensor.poubelle.state == "1" %}{%- set icon = "bell-ring blink" -%}<i class='mdi mdi-trash-can'</i> <i class='mdi mdi-{{icon}}'></i> - Demain{% endif %}

            {% if states.sensor.carton.state == "1" %}{%- set icon = "bell-ring blink" -%}<i class='mdi mdi-trash-can'</i> <i class='mdi mdi-{{icon}}'></i> - Demain{% endif %}
            `,
        class: "put-outs"
    }]
},
wonderslug commented 2 years ago

Glad to hear it.