MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord
    1. Home
    2. Unbored
    3. Posts
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 9
    • Best 0
    • Controversial 0
    • Groups 0

    Posts made by Unbored

    • Train status from webpage (not RSS)

      Looking for some guidance. Is there a module that reads a table on a webpage and then rotates the statuses like the new feed? If not, I would settle for just updating the status.

      There is a commuter train that runs from Virginia into Wash., DC. called the VRE. Their site has a RSS feed, but it doesn’t really track individual trains. The status that I am looking to pull is on this site: http://www.vre.org/service/status/

      I haven’t read up on iframes and I am pretty sure that I am not using iframes in my current build. I guess I could, if that is required.

      It is late in the day and the number of trains are starting to fade from the webpage, so here is what it looks like in case there are no trains listed when you look.

      0_1496362484176_train.png

      The code on the page looks like this:

      <div class="widget case-status">
      <h3 class="label case-status">Live Tracking</h3>
      <span class="label case-status">(Status Tracked via GPS)</span>
      <p class="description case-status">Train Status as of <span id="tripUpdateDate">Thursday, June 1, 2017</span> - <span id="tripUpdateTime">7:44 PM</span></p>
      <table id="tripupdates">
      <thead>
      <tr>
      <td><strong>Train Number</strong></td>
      <td><strong>Status</strong></td>
      </tr>
      </thead>
      <tbody>
      <tr>
      <td colspan="2">Loading...</td>
      </tr>
      </tbody>
      </table>
      <div id="delay-status" class="flow-center">
      &nbsp;
      </div>
      </div>
      

      Thanks,
      Danny

      posted in Requests
      Unbored
      Unbored
    • RE: Display a Web Page

      @jasondreher

      I think this is it
      https://forum.magicmirror.builders/topic/706/halloween-mirror-ghouls-anyone

      posted in General Discussion
      Unbored
      Unbored
    • RE: Can I control a relay on MagicMirror2?

      I recently worked through a similar issue.

      https://forum.magicmirror.builders/topic/2452/python-one-momentary-switch-led-and-a-shut-off-timer

      posted in Development
      Unbored
      Unbored
    • RE: How to update.

      @izanbard Thank you.

       #!/usr/bin/env bash
      
      cd /home/pi/MagicMirror
      echo "######### CHECKING MAGIC MIRROR ##########"
      

      Has anyone else deployed this script?

      When I try to run it as a .py or .sh there is an error on line 6 stating invalid syntax at the end of the first echo row. Any suggestions on clearing this issue?

      posted in Tutorials
      Unbored
      Unbored
    • RE: Python - One momentary switch, LED, and a shut-off timer

      Here’s a pic of the work in progress.
      alt text

      posted in Troubleshooting
      Unbored
      Unbored
    • RE: Python - One momentary switch, LED, and a shut-off timer

      Re: Python - One momentary switch

      I found the answer over on stackexchange and figured I would share. The mirror is a college graduation present for my youngest daughter; she requested the light ring (I heard the word make-up followed by blah, blah, blah, blah…, kidding of course.). The 30 minute timer was not a joke, there’s no way I am leaving responsibility of turning off the light to a college grad 🤦🏼

      I am still working on it and will post a thread in the correct forum when it is done.

      The answers are here: https://raspberrypi.stackexchange.com/questions/66639/python-one-momentary-switch-led-and-a-shut-off-timer?answertab=active#tab-top

      #!/usr/bin/env python
      
      import time
      import pigpio
      
      LEDPin = 26
      buttonPin = 5
      
      LEDOn = False
      minutesOn = 0
      
      def callback(gpio, level, tick):
         global minutesOn, LEDOn
         if level == 0: # button press
            if LEDOn:
               print("LED off")
               LEDOn = False
               pi.write(LEDPin, 0)
            else:
               print("LED on")
               LEDOn = True
               pi.write(LEDPin, 1)
               minutesOn = 0
         elif level == pigpio.TIMEOUT:
            if LEDOn:
               minutesOn += 1
               print("LED on for {} minutes".format(minutesOn))
               if minutesOn >= 30:
                  print("LED off")
                  LEDOn = False
                  pi.write(LEDPin, 0)
      
      pi = pigpio.pi()
      if not pi.connected:
         exit()
      
      # Setup the pin the LED is connected to
      pi.set_mode(LEDPin, pigpio.OUTPUT)
      
      # Setup the button
      pi.set_mode(buttonPin, pigpio.INPUT)
      pi.set_pull_up_down(buttonPin, pigpio.PUD_UP)
      pi.set_glitch_filter(buttonPin, 5000)
      
      pi.set_watchdog(buttonPin, 60000)  # watchdog every minute
      
      cb = pi.callback(buttonPin, pigpio.EITHER_EDGE, callback)
      
      while True: # all the work is done in the callback
         time.sleep(1)
      
      posted in Troubleshooting
      Unbored
      Unbored
    • RE: 3 different Alexa modules, which one is the best?

      @romain said in 3 different Alexa modules, which one is the best?:

      To do it, first deactivate the service with the terminal by writing sudo systemctl stop AlexaPi.service; sudo systemctl disable AlexaPi.service (you can reactivate later by doing sudo systemctl enable AlexaPi.service).
      Then you can run AlexaPi yourself by writing in the terminal /opt/AlexaPi/src/main.py -d (If you you putted it on that location anyway).

      Thanks. This proves that the Pi can hear me, process the input, have Alexa provide a spoken response, and peace of mind for me… Also, the response is comparable to my standalone Alexa, when running in this mode. Too bad, I can just run this method all the time.

      posted in General Discussion
      Unbored
      Unbored
    • Python - One momentary switch, LED, and a shut-off timer

      Working on programming a LED strip lights around the mirror, with a single push button. I am good with the GPIOs and the relay required, but seeking some guidance on the code

      • First button press: Lights activate. Have the option to move to the second button press or if the button is not pressed a second time, then the side lights will turn off automatically after 30 minutes.
      • Second button press: Lights turn off and python is waiting for the first button press (again).

      Below is one version that I been working on where I wanted to divide the lights (side lights (“low”), then side&top lights (“high”), then all off), but at this point I would settle for just all lights at the same time.

      The auto-shutoff is required to ensure they aren’t left on for days at time. 🙂

      It is possible that I need to pull in another module, but I can’t seem to hack my way into figuring out the shutoff timer or where to place it, so it is time to call in a lifeline. Thanks.

      import RPi.GPIO as GPIO
      from time import sleep
      
      GPIO.setmode(GPIO.BCM)
      
      LEDPinLow = 26
      LEDPinHigh = 22
      buttonPin = 5
      
      # Setup the pin the LED is connected to
      GPIO.setup(LEDPinLow, GPIO.OUT)
      GPIO.setup(LEDPinHigh, GPIO.OUT)
      
      # Setup the button
      GPIO.setup(buttonPin, GPIO.IN, pull_up_down = GPIO.PUD_UP)
      
      buttonPress = True
      ledStateLow = False
      ledStateHigh = False
      
      while (1):
              print("Press it")
              buttonPress = GPIO.input(buttonPin)
              if buttonPress == False and ledStateLow == False and ledStateHigh == False:
                  GPIO.output(LEDPinLow, True)
                  GPIO.output(LEDPinHigh, False)
                  print("LED ON - Side lights only")
                  ledStateLow = True
                  ledStateHigh = False
                  sleep(.25)
                  
              elif buttonPress == False and ledStateLow == True and ledStateHigh == False:
                  GPIO.output(LEDPinLow, True)
                  GPIO.output(LEDPinHigh, True)
                  print("LED ON - Side and Top Lights ")
                  ledStateLow = True
                  ledStateHigh = True
                  sleep(0.25)
      
              elif ledStateLow == True and ledStateHigh == True:
                  sleep(5)
                  GPIO.output(LEDPinLow, False)
                  GPIO.output(LEDPinHigh, False)
                  print("LEDs OFF")
                  ledStateLow = False
                  ledStateHigh = False
                  sleep(0.5)
      
              sleep(0.15)
      
      
      
      posted in Troubleshooting
      Unbored
      Unbored
    • 1 / 1