MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Visibility of variables in MMM-HomeAssistantDisplay

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    8 Posts 2 Posters 648 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      DrKaMo @sdetweil
      last edited by

      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.

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @DrKaMo
        last edited by

        @DrKaMo said in Visibility of variables:

        I would like if a fixed is closed (status false)

        what is a ‘fixed’?

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        D 1 Reply Last reply Reply Quote 0
        • D Offline
          DrKaMo @sdetweil
          last edited by

          @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.

          S 2 Replies Last reply Reply Quote 0
          • S Offline
            sdetweil @DrKaMo
            last edited by sdetweil

            @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

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @DrKaMo
              last edited by

              @DrKaMo did you resolve this?

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Enjoying MagicMirror? Please consider a donation!
              MagicMirror created by Michael Teeuw.
              Forum managed by Sam, technical setup by Karsten.
              This forum is using NodeBB as its core | Contributors
              Contact | Privacy Policy