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

MagicMirror isn't publishing 'user_presence' on start up?

Scheduled Pinned Locked Moved Unsolved Troubleshooting
17 Posts 2 Posters 2.8k 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.
  • F Offline
    fribse
    last edited by Sep 9, 2021, 8:27 PM

    I’ve started rebooting my mirror once a day due to the problem with the newsreader mentioned elsewhere.
    This made another bug apparent.
    I’m turning the HDMI on and off depending on presence, and I also report the state to MQTT.
    But it seems that if the HDMI is turned off, and then a reboot is done the HDMI is turned on, but the change in USER_PRESENCE isn’t sent in notifications, so the MQTT shows the monitor as turned off (if it was turned off before the reboot).

    S 1 Reply Last reply Sep 9, 2021, 8:55 PM Reply Quote 0
    • S Offline
      sdetweil @fribse
      last edited by sdetweil Sep 10, 2021, 3:04 PM Sep 9, 2021, 8:55 PM

      @fribse that’s because it’s not a change. typically the code doesn’t inspect the state, just sets it

      so it doesn’t know it was off, and user_presence is different anyhow.

      if u can use curl to post a message to the mq channel, then add a line to the startup script to send the user presence notification

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      F 2 Replies Last reply Sep 11, 2021, 7:58 PM Reply Quote 0
      • F Offline
        fribse @sdetweil
        last edited by Sep 11, 2021, 7:58 PM

        @sdetweil Not sure how to do that to the MQTT channel, but can I send a notification when it’s started up? That would be picked up by the MQTT mirror addon?

        1 Reply Last reply Reply Quote 0
        • F Offline
          fribse @sdetweil
          last edited by fribse Sep 11, 2021, 9:53 PM Sep 11, 2021, 8:57 PM

          @sdetweil Ok, I found the mosqitto_pub command, so I can publish with that to MQTT, which startup script is it, and can I make sure it’s done loading before running the command?

          S 1 Reply Last reply Sep 11, 2021, 11:30 PM Reply Quote 0
          • S Offline
            sdetweil @fribse
            last edited by sdetweil Sep 11, 2021, 11:44 PM Sep 11, 2021, 11:30 PM

            @fribse how do u start mm? pm2?

            if so it runs the installers/mm.sh

            pm2 info xx
            where xx is the name or number of the pm2 entry shown by pm2 status
            will show u the command used to start mm

            if you used my install script and selected pm2,
            then the script is
            ~/MagicMirror/installers/mm.sh

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            F 1 Reply Last reply Sep 13, 2021, 8:43 PM Reply Quote 0
            • F Offline
              fribse @sdetweil
              last edited by Sep 13, 2021, 8:43 PM

              @sdetweil Ok, yes, I used your script.

              So it just says

              # This file is still here to keep PM2 working on older installations.
              cd ~/MagicMirror
              DISPLAY=:0 npm start
              

              So I guess that just launches it, but it’s not actually ready at that point, thus the MMM-MQTTbridge is also not ready to receive the ‘hdmi off’ command.
              Aren’t there some sort of notification that says ‘done, ready for running’ when it starts, I could put that notification in the MMM-MQTTbridge so that would also launch the ‘SCREENON’ back to MQTT.

              S 1 Reply Last reply Sep 13, 2021, 8:48 PM Reply Quote 0
              • S Offline
                sdetweil @fribse
                last edited by Sep 13, 2021, 8:48 PM

                @fribse there is no simple way…

                do you get an error from trying to post the message?

                if so, I would check and loop and sleep a little, then try again

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                F 1 Reply Last reply Sep 13, 2021, 9:00 PM Reply Quote 0
                • F Offline
                  fribse @sdetweil
                  last edited by Sep 13, 2021, 9:00 PM

                  @sdetweil Darned, that’s really sad, it seems logical to make a notification that says done setting up, and running. Oh well, always room for improvement in the code :-)

                  S 1 Reply Last reply Sep 13, 2021, 9:03 PM Reply Quote 0
                  • S Offline
                    sdetweil @fribse
                    last edited by sdetweil Sep 13, 2021, 9:04 PM Sep 13, 2021, 9:03 PM

                    @fribse yes, inside… but u are outside (Oh I see, change the module)

                    from the doc
                    https://docs.magicmirror.builders/development/core-module-file.html#subclassable-module-methods

                    ALL_MODULES_STARTED

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    F 1 Reply Last reply Sep 13, 2021, 10:10 PM Reply Quote 0
                    • F Offline
                      fribse @sdetweil
                      last edited by Sep 13, 2021, 10:10 PM

                      @sdetweil Ahaaaa, way cooler :-)

                      So I guess I should add this to the notiDictionary.js
                      I’m unsure of the payloadValue?

                      {
                        notiId: "ALL_MODULES_STARTED",
                        notiPayload: [
                          {
                            payloadValue: '1',
                            notiMqttCmd: ["SCREENON"]
                          }
                        ]
                      }
                      
                      S 1 Reply Last reply Sep 13, 2021, 10:12 PM Reply Quote 0
                      • 1
                      • 2
                      • 1 / 2
                      1 / 2
                      • First post
                        1/17
                        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