MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

    Shutdown Magic Mirror with Home Assistant

    Troubleshooting
    3
    8
    823
    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.
    • J
      jordes last edited by

      I am trying to turn off my Magic Mirror from HomeAssistant. But somehow did not work.

      MQTT - does not work
      SHELL COMMAND + MMM-Remote-Control

      Can someone show me a simple solution, or an example me the above listed?

      cowboysdude 1 Reply Last reply Reply Quote 0
      • cowboysdude
        cowboysdude Module Developer @jordes last edited by cowboysdude

        @jordes

        https://www.shellhacks.com/raspberry-pi-shutdown-reboot-safely-command/

        I used this and it worked… here’s an example:

        I use a Sonos smart plug through SmartThings to turn off the Pi and turn it back on.

        There are commands from the above link you can use. For instance I used commands to control my Vizio TV through Home Assistant.

        Here is my ‘script’ for my TV.

        - platform: command_line
          switches:
              living_room_tv:
                friendly_name: TV
                command_on: "/usr/bin/curl -k -H \"Content-Type: application/json\" -H \"AUTH: Zzbaa0sttq\" -X PUT -d '{\"KEYLIST\": [{\"CODESET\": 11,\"CODE\": 1,\"ACTION\":\"KEYPRESS\"}]}' https://192.168.1.20:7345/key_command/"
                command_off: "/usr/bin/curl -k -H \"Content-Type: application/json\" -H \"AUTH: Zzbaa0sttq\" -X PUT -d '{\"KEYLIST\": [{\"CODESET\": 11,\"CODE\": 0,\"ACTION\":\"KEYPRESS\"}]}' https://192.168.1.20:7345/key_command/"
                command_state: "/usr/bin/curl -k -H \"Content-Type: application/json\" -H \"AUTH: Zzbaa0sttq\" -X GET https://192.168.1.20:7345/state/device/power_mode"
                value_template: >
                  {% if value_json.ITEMS.0.VALUE == 1 %}
                    true
                  {% else %}
                    false
                  {% endif %}
        

        You can do the same to control the pi 🙂

        J 1 Reply Last reply Reply Quote 1
        • J
          jordes @cowboysdude last edited by jordes

          @cowboysdude thank you for your answer however i do not understand how to translate this for my problem

          hier is my solution that doesnt work for me:

          
          # Example configuration.yaml entry
          switch:
            - platform: command_line
              switches:
                 magic_mirror_rpi:
                  command_on: "/usr/bin/curl -X GET http://192.168.178.45:8080/remote?action=SHUTDOWN"
                  friendly_name: magic_mirror
          
          cowboysdude 1 Reply Last reply Reply Quote 0
          • D
            DeanoNoire last edited by

            I’m using my old Broadlink wifi smart plug. It has integration in HA, so the setup is “next next finish” style.
            Automation turns it on at 6 AM and turns off at midnight.

            J 1 Reply Last reply Reply Quote 0
            • J
              jordes @DeanoNoire last edited by

              @deanonoire nice but how do you turn off your raspberry pi safely before you turn off electricity?

              D 1 Reply Last reply Reply Quote 0
              • cowboysdude
                cowboysdude Module Developer @jordes last edited by cowboysdude

                @jordes

                Look here

                https://community.home-assistant.io/t/ssh-and-raspberry-pi/240832/2

                J 1 Reply Last reply Reply Quote 0
                • J
                  jordes @cowboysdude last edited by

                  hey i solve everything very simple with:

                  https://github.com/daviptrs/hass-unified-remote
                  https://www.crackedconsole.com/2019/04/08/installing-unified-remote-for-raspberry-pi/

                  1 Reply Last reply Reply Quote 0
                  • D
                    DeanoNoire @jordes last edited by

                    @jordes First part of the automation is ssh call for shutdown.
                    81b2715c-7ddc-4528-9d6c-c60ea332f0ec-image.png

                    Finding a working script took me a while, but it works like a charm without any excessive MM modules.

                    All you need is to setup passwordless ssh connection between HA and MM.

                    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 Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
                    This forum is using NodeBB as its core | Contributors
                    Contact | Privacy Policy