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.

    Ways to automate shutdown and startup

    Scheduled Pinned Locked Moved Hardware
    raspberry pishutdownautomationhome assistant
    7 Posts 5 Posters 2.3k Views 5 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.
    • M Offline
      MMRIZE @hesspoint
      last edited by

      @hesspoint
      Your HA might be able to turn on/off switch by schedule. If you set cut power of pi off on 23:00 by HA, just execute shutdown script before through cron on pi… every 22:55?

      1 Reply Last reply Reply Quote 0
      • BKeyportB Offline
        BKeyport Module Developer @hesspoint
        last edited by BKeyport

        @hesspoint

        I use https://www.amazon.com/gp/product/B087FXLZZH/ as a UPS - it has scriptable shutdown and startup operations - and external leads so you can remotely power on device. something like this might work for you, although, the power consumption is so small, other than the monitor, so I wouldn’t worry about shutting it down, just the monitor.

        Also, I’ve decided to change it out, I’m going with a PiJuice UPS instead. need more space.

        The "E" in "Javascript" stands for "Easy"

        1 Reply Last reply Reply Quote 0
        • kayakbabeK Offline
          kayakbabe @hesspoint
          last edited by kayakbabe

          @hesspoint You can shut down the operating system BUT you can’t completely shutdown the power to it. The only way to actually have the pi completely off is to unplug it. By running a shutdown command the led on the pi will still be drawing power and showing you it “isn’t running”.

          If you just want to shutdown the operating system/mirror etc and don’t care that the pi still has power… Then, you can do it via the operating system. There is a thing called a cron job which you setup on the crontab. You can set it to run every night at the same time.

          Here is a link on the raspberry pi forum about retropi (a different project) that will tell you how setup your cron .
          https://www.raspberrypi-spy.co.uk/2018/03/raspberry-pi-retropie-shutdown-button/

          There are some MagicMirror modules that might help you do the same thing via a web url that points to the pi at your house. You would need a fixed ip address at your house, setup your router to allow the outside world to talk directly to your pi, and setup the module too. I haven’t used one of them.

          I think there is an Internet of Things IOT module that could probably work via IFTTT too.

          1 Reply Last reply Reply Quote 0
          • H Offline
            hesspoint
            last edited by

            Wow, I am blown away by the many responses. Thanks so much guys!

            Especially thanks @sdetweil, for pointing me in the right direction with MMM-Remote-Control. That module is absolutely awesome. I now figured out the whole thing, so here it is if anyone likes to know:

            First I installed https://github.com/Jopyth/MMM-Remote-Control
            You need to use the Rest API requests as in the instructions in the module

            I found this for HA: https://community.home-assistant.io/t/controlling-magicmirror2-from-ha/138527

            So I need to add each rest api call I want to automate as service in HA. Then I can trigger the service i.e. shutdown in my “leave house” and “night mode” automations.

            There are then 2 steps:

            1. shutting down the Pi via the service/rest api call
            2. wait a min or two and then kill the power to the pi by switching of the outlet which I can do also in the automation.

            When the state change is triggered (e.g. I return home or I start moving in the house in the morning) then the automation just turns the outlet back on and the Pi will boot.

            H 1 Reply Last reply Reply Quote 1
            • H Offline
              hesspoint @hesspoint
              last edited by

              @hesspoint Update: There is actually a custom HA integration that is awesome: https://github.com/sindrebroch/ha-magicmirror

              So I switched form the REST API to that integration and it is even better

              1 Reply Last reply Reply Quote 1
              • 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