Read the statement by Michael Teeuw here.
MagicMirror isn't publishing 'user_presence' on start up?
-
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). -
@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
-
@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?
-
@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?
-
@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 mmif you used my install script and selected pm2,
then the script is
~/MagicMirror/installers/mm.sh -
@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 startSo 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. -
@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
-
@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 :-)
-
@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-methodsALL_MODULES_STARTED
-
@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"] } ] } -
@fribse sorry, now no idea, don’t know the module internals
-
@sdetweil Ok, gotcha. I’m trying to figure out the notification, currently the MMM-MQTTbridge doesn’t pick it up.
I’ve set up MMM-ViewNotifications, but I’m drowning in noti’s.
I made this config{ module: "MMM-ViewNotifications", position: "top_left", header: "Notifications", config: { excludeModules: ["clock","newsfeed","currentweather","calendar","MMM-News-QR"] } },What did I do wrong since it still displays noti’s from these?
-
@fribse u can filter messages by placing part of the modulename in the filter field
-
@sdetweil Hey Sam, sorry you lost me, “filter field”?
@bugsounet If you are still around, do you have any idea about the notification format in notiDictionary.js?
-
@fribse sorry, I was using the dev window, console tab
-
@sdetweil Ahh, yes, and there I do see the
sendNotification("ALL_MODULES_STARTED");Going out, hmm, it seems that it’s main sending it out, I wonder if that is supposed to be payload Value, and notiId is supposed to be something like main? Hmm, I hope sergge1 or @bugsounet knows that.
-
@fribse notifications don’t have to have a payload
I think the source could be null too
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login