• Justas🇱🇹@sh.itjust.works
    link
    fedilink
    arrow-up
    7
    ·
    25 days ago

    I used to work at a place outside the city that only had one bus after work and it was kinda spotty and unreliable. However, there was an online API provided by the bus company that told me where the bus is.

    So I wrote a Python script and a Linux alert that would give me a notification when the bus was within range, with enough time to get to the stop on time.

    • cheese_greater@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      25 days ago

      Can this be done for basically… any transit? How do you search for api url or stream feed? Its not anything like RSS is it?

      • Justas🇱🇹@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        ·
        25 days ago

        I found a webpage that uses it and found out that it requires no authentication. So I just copied the url and sent a request every 5 seconds just like the webpage did. It gave a csv of busses, their routes and gps locations.

  • 🍉 Albert 🍉@lemmy.world
    link
    fedilink
    arrow-up
    6
    ·
    26 days ago

    some discord bots on a private server, notify me whenever a paper in my scientific field is published.

    have another one about whenever senator or a representative trades stock.

    useful.

  • stoy@lemmy.zip
    link
    fedilink
    arrow-up
    5
    ·
    26 days ago

    A few years back me and my dad set up a raspberry pi with a temperature probe to monitor the water temp in a local swimming hole, it reports the temperature every half hour and submits it to a private webpage.

    Works really well

    • CmdrShepard49@sh.itjust.works
      link
      fedilink
      arrow-up
      2
      ·
      25 days ago

      That’s a rad idea. How are you powering and communicating with it? When I hear “watering hole” I picture a secret swimming spot out in the woods somewhere.

      • stoy@lemmy.zip
        link
        fedilink
        arrow-up
        5
        ·
        25 days ago

        It run off of a 12v motorcycle battery, the whole thing is on a timer, every halfhour, the timer gives the pi power for two minutes, during those two minutes the pi boots up, and runs a bash script to collect and send the data, wait for one min and shutdown the pi.

        The pi communicates over wifi with a friendly neighbouring house.

          • stoy@lemmy.zip
            link
            fedilink
            arrow-up
            5
            ·
            25 days ago

            Some more details, the temperature probe is a DS18B20, it connects to the GPIO pins, and communicates over the 1-w protocol which is built into the pi, you get the data digitally in celsius, if it is a negative temperature it is a hassle to deal with so I just made it report 0 as default when it is too close.

            The probe can error out, it then reports the temp as 85, since the water never actually gets that high in reality, I solved it by checking if the value returned from the probe is 85 before submitting it, if it is, it will take another measurement, check that for 85, if that is still 85, it will check one final time and then just submit the result, so far this has solved the issue.

            Once the data is formated and ready, the pi makes an HTTP request, posting the data using curl, to a simple PHP/MySQL site I hacked together, where a page displays the current temp, a timestamp of when the temp was taken and a small graph showing changes to the temp over the last 24h


            Planned improvements:

            Use the status field that the pi reports to include wifi signal strength, as trees grows around the device it will reduce the signal strength meaning that measurements are lost, with the signal strength data we can check how bad it is and clear leaves ahead of the problem.


            Considered improvements:

            Security, as it stands right now, there is zero security to submit data to the database, anyone can just access the submit.php page and it will add an empty entry to the database, or if they figure out the syntax they can just post whatever data they want into the database. I would like to add a simple validation of a static random string that the pi sends along with the rest of the data. I am no real webdev, just an IT guy who hacked this together.

            Power monitoring, it would be good to have an idea of of how well charged the battery is, it would require a separate module which would also require power, reducing the battery life as it is. Currently the battery lasts a few months and we have a manual schedule to replace it, it is not a huge problem, but it would be nice to have the data.

          • stoy@lemmy.zip
            link
            fedilink
            arrow-up
            4
            ·
            25 days ago

            I forgot about three more technical aspects of the device…

            The bash script it set up to run as a service in systemd, this is to make it run on startup and have some control over it, this is important for the next part.

            The one min delay after submitting the data and shutting down the pi, this gives me time to find the command to stop the script before the script shuts down the pi, this is important so you can access the system and service it.

            Why shut it down at all, the power will be cut shortly after?

            This is to preserve the filesystem and reduce the risk of corruption, consider that the pi will turn on and off 24 times every day, any error caused by improper shutdowns will quickly amplify.

            • DontNoodles@discuss.tchncs.de
              link
              fedilink
              arrow-up
              1
              ·
              25 days ago

              I think a Pi is an overkill for this. If I were to attempt this, i would try getting it done with an ESP8266 module which uses far less power, making the battery last much longer. Bootup and shutdown times would be much less so using coin cells or supercapacitors charged using small solar panels could also be used. If your home is not too far (few km), using LoRa could eliminate dependency on the WiFi. Cool use case, nonetheless!

              • stoy@lemmy.zip
                link
                fedilink
                arrow-up
                1
                ·
                25 days ago

                A Pi is obviously overkill, even a Pi Z w which we ended up using, but they are efficient enough for us, and more importantly, I know the system, and I could relatively quickly get it working using just bash on the Pi.

                I was not really interested in learning how to program on a different system just for this.

                We did some power analytics on the Pi and disabled a few things, sorry I don’t remember it right now.

                The unit is placed in a semi public place where teenagers sometimes congregate and we don’t want to draw any attention to the device, so solar power is out.

                A LoRa unit though could be interesting to implement, sadly my parents house is up a steap hill and there is no line of sight.

                I have been thinking of experimenting with Meshtastic and LoRa for off grid coms due to the geopolitical situation here in Europe, might be worth it getting a few units to test out.

  • halloween_spookster@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    25 days ago

    I’ve been playing Factorio with a friend. Our factory was getting large enough that him downloading the map and catching up was getting really slow (even though the factory itself wasn’t that big). We ended up setting up a VPN which somehow made that process SIGNIFICANTLY faster. However, I really only wanted the VPN on while we were playing the game. So I ended up writing some automation to detect if I was no longer playing and the VPN was still active and then shut it off automatically. It’s a small thing but I’m both proud of it and happy with the results.

  • r0ertel@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    24 days ago

    Wxterior lights turn on and off with sunrise and set. It’s been running on a raspberry pi b for ages with Misterhouse. I’d like to change it over to something newer, but I automated it because I have other things to do.

    I used to download school menus and expose it to my phone as an ical feed, but no longer need that. It still runs. I should shut it off some day…

  • Lovable Sidekick@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    25 days ago

    I’m really into IoT automation - wiring up Arduino & ESP devices and programming them - but tbh it’s hard to think of much to automate IRL. So I haven’t automated anything yet. I want a few ourdoor lights to sense motion more elaborately than just having a motion sensor built in - to light up when approached from opposite directions. Also to add switches indoors where I didn’t think to put them when I wired the house. So like, have several ESP32 wall switches tell a room light to turn on or off without running new AC lines through the walls. That would be super useful. Another one is subtle night lighting on stairways for safety, so my eventual cause of death isn’t falling downstairs after tripping on a cat.

  • Goldholz @lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    1
    ·
    24 days ago

    Communication. Everything. With my partner.

    Us both come from familys that never communicate and live without a day plan. Our life has improved so much

  • JoeKrogan@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    25 days ago

    Monthly backups of containers and volumes, notifications of disruptions, rules for salary to send it to the right places. Arr stack saves a ton of time too