• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.

How to change icon and payload by notification?

Scheduled Pinned Locked Moved Development
7 Posts 2 Posters 982 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.
  • S Offline
    sdetweil @MrCoffee
    last edited by sdetweil Oct 9, 2020, 5:34 PM Oct 9, 2020, 2:29 PM

    @MrCoffee so the home automation code should send some ID with the notice, on or off…
    and u have some table where u look up the ID (you could set the ID on the button in html)

    what you are SUPPOSED to do, is save the info and then call updateDom(), which will regenerate the content by calling getDom().

    lots of other modules change the dom directly, by using appropriate apis
    so, the ID gets you the button object, and u can change its img tag src= value (or change its class which does all that)

    var button=document.getElementById(id)
    

    and of course u can examine the current class, or src= to use that as the ‘state’ you are toggling

    Sam

    How to add modules

    learning how to use browser developers window for css changes

    M 1 Reply Last reply Oct 9, 2020, 5:47 PM Reply Quote 0
    • M Offline
      MrCoffee @sdetweil
      last edited by Oct 9, 2020, 5:47 PM

      @sdetweil Thank you. That helped me unterstanding a bit more.
      But it still seems a little bit far away for me for the moment:-)
      Maybe I just found an alternative method. I played around with MMM-Touch a little.
      The module has a possiblity to change the notification to send, the next time the button is pressed.
      So if the button is pressed an light is turned on, than the notification send next time when the button is pressed can change to “turn off”.
      MMM-Touch - on notification

      Unfortunately it seems like the module only works with one button.

      What is your opinion on this module?
      Could you please have a look if I am right with one button only?
      Will it be possible to install multiple instances like MMM-Touch1, 2, 3 … or even add some buttons customizing the code?

      Thanks again.

      S 1 Reply Last reply Oct 9, 2020, 5:49 PM Reply Quote 0
      • S Offline
        sdetweil @MrCoffee
        last edited by Oct 9, 2020, 5:49 PM

        @MrCoffee sorry, no info on that module, never used it. no idea if multiple instances can be used at once.

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        M 1 Reply Last reply Oct 9, 2020, 5:54 PM Reply Quote 0
        • M Offline
          MrCoffee @sdetweil
          last edited by Oct 9, 2020, 5:54 PM

          @sdetweil Never mind. I will ask the developer.
          I´ve just seen that you helped this guy out: image-on-notification. Things get clearer. Guess I have to try and play around a little.

          Probably the best way is to set up a new module. Never tried it. Probably it will take some time:-)

          S 1 Reply Last reply Oct 9, 2020, 6:14 PM Reply Quote 0
          • S Offline
            sdetweil @MrCoffee
            last edited by Oct 9, 2020, 6:14 PM

            @MrCoffee my sample module is here
            https://github.com/sdetweil/SampleModule

            based on what u wanted I assumed u were writing your own module to put multiple images over the floor layout

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            M 1 Reply Last reply Oct 9, 2020, 6:57 PM Reply Quote 0
            • M Offline
              MrCoffee @sdetweil
              last edited by Oct 9, 2020, 6:57 PM

              @sdetweil Guess you are right.
              I just cloned your sample module.
              Thanks for helping me out.

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              1 / 1
              • First post
                6/7
                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