11 votes

What programming/technical projects have you been working on?

This is a recurring post to discuss programming or other technical projects that we've been working on. Tell us about one of your recent projects, either at work or personal projects. What's interesting about it? Are you having trouble with anything?

3 comments

  1. json
    Link
    Did some electronics for the first time in about 15 years. Wired up a spare/third party garage door remote to a Raspberry Pi via a relay board. Telegram bot controlled garage door is fun. Combined...

    Did some electronics for the first time in about 15 years. Wired up a spare/third party garage door remote to a Raspberry Pi via a relay board.

    Telegram bot controlled garage door is fun. Combined with my PTZ camera I have video feedback of the door opening or closing. Saves having a stupid remote on my keys or wandering around.

    3 votes
  2. vord
    (edited )
    Link
    There's some solar inverters in my garage, but they're in a bit of a wifi dead spot. Rather than buying new hardware, I dusted off my old Linksys WRT54GL, the oldest piece of functioning computer...

    There's some solar inverters in my garage, but they're in a bit of a wifi dead spot. Rather than buying new hardware, I dusted off my old Linksys WRT54GL, the oldest piece of functioning computer equipment in my home. While OpenWRT no longer works, there's still community firmware being released.

    I never really had thought to do this before, but the WRT54G has GPIO controls for several LEDs and the WPS button. Tomato had a built in functionality to run a custom script on button press, which would provide a $1 variable with the tier of length held down (about 5 tiers until 12s+).

    I created a bash script to call out to home assistant, so I can control the lights in my office and a "Dad is in a meeting" light based on how long I push the button. It was a bit trickier, because curl was not included (working with < 4MB Flash here!). Instead had to craft the request using netcat, but it turned out to be fairly simple and I'll likely use this method in the future even on less resource-constrained systems.

    Here it is. Disclaimer: Don't do this on an untrusted network, it's just straight http.

    #!/bin/sh
    
    # HA stuff
    SERVER=<SERVERNAME>
    TOKEN=<AUTHORIZATION TOKEN>
    
    #GPIO controls
    AMBER='gpio disable 3 ; gpio enable 2'
    WHITE='gpio enable 3 ; gpio disable 2'
    BLACK='gpio enable 3 ; gpio enable 2'
    
    # If held for > 5ish seconds, change entity.  Requires fiddling for preference
    if [ $1 -gt 2 ]; then
      LIGHT='light.office'
      eval $AMBER
    else
      LIGHT='light.meeting'
      eval $WHITE
    fi
    CALL='{"entity_id":"'${LIGHT}'"}'
    sleep 1
    
    nc -w 5 $SERVER 8123 <<EOF
    POST /api/services/light/toggle HTTP/1.1
    Host: ${SERVER}
    Content-Type: application/json
    Content-Length: ${#CALL}
    Authorization: Bearer ${TOKEN}
    
    ${CALL}
    EOF
    
    sleep 2
    eval $BLACK
    
    exit 0
    

    Edit: Now I'm nostalgic, and I miss my 2002-era Dell Inspiron 8200. Thing cost more than my first car, but by god 1600x1200 was such an amazing resolution.

    2 votes
  3. [2]
    Comment deleted by author
    Link
    1. vord
      Link Parent
      <glares at you in DBA> Nobody likes curly quotes. ;) /joke

      Converting straight quotes to curly quotes is a prickly problem

      <glares at you in DBA>

      Nobody likes curly quotes. ;)

      /joke

      3 votes