Meta(
    title: "Old phone morning project",
    summary: Some("After being forced into a phone upgrade, I decide to make use of the old hardware"),
    published: Some(Time(
        year: 2023,
        month: 8,
        day: 16,
        hour: 20,
        minute: 23,
        second: 12,
    )),
    tags: [
        "android",
        "apache",
    ],
)
---
We've had a family mobile plan with Verizon for a number of years now. The service wasn't bad, but the price kept creeping up no matter what we did. It always amazes me how companies these days are so willing to punish their long time customers with higher rates while offering a much better package if you should "switch" from another service. Seems like a really backwards way of doing business to me. Anyway, due to my SO being a first responder we qualified for an AT&T special plan that will prioritize her phone if the lines are crowded. The best part is that it's a pretty good savings, and not just an introductory rate. We should be able to save money for years to come, so we switched.

One of the annoying things about the switch is that we were unable to carry our current phones over due to being carrier locked. I've always hated this practice. It's a totally non-subtle way of locking you into your current carrier. Well, FU Verizon, because even after putting four new phones on a payment plan we're still saving $50 a month. But I hate to see the old hardware, which still has plenty of life left in it, just sitting in a drawer. Her phone, and my daughter's, were new enough to trade in. That leaves mine and my son's. I'll be trying to think of something cool to do with his, but this morning I put mine to use with a nice simple project.

## The Android petcam
Currently napping next to me on the couch is our four year old rat terrier mix named Spock. He's a really cool little dog who is 100% a family member, who I would take a bullet for if it came to it (and I'm pretty sure the feeling is mutual). We work overrlapping shifts, and as a consequence Spock is alone in the house for about six hours a day until I get home. I've always thought it would be cool to have a way to check in on him when I have a spare minute during the day, and since the old phone has a perfectly capable camera it seemed a perfect match.

This is a really basic setup. After removing almost everything else from the old phone I installed an app called DroidCam from the Play store. I'm going to be checking out some others because it does do some phoning home, but for now it does what I need it to and I'm relatively happy with the security. DroidCam streams a low res video feed (240p) over http on port 4747 in the local network and keeps the phone awake while it's running. That means the phone has to stay plugged in, which is totally fine since it's sitting immobile on the TV stand.

The other component of the setup is a reverse proxy using Apache. I setup a new subdomain in DNS, added the reverse proxy and protected it with a simple .htaccess. It's not perfect security. If you can gain access to the LAN you can probably turn it on and watch a video stream from my living room, but if you're in my lan I'm already screwed. At least with this setup my feed isn't going out to some cloud service in order to make it to the wider internet like almost every commercial offering does, so in that sense I'm satisfied with the security.

I have visions of a more complete system that would allow me to talk to him and dispense treats, using an MCU with network capability to drive a servo that would operate what amounts to a bubble gum dispenser adapted for dog treats. Not sure how I'd do the voice trick just yet. I'm pretty sure I could wrap the proxy up in a php application running on the same machine as Apache and add some buttons for other functions without a ton of effort, making the entire thing friendly enough for my son and SO to use. My son already got on the camera the minute I gave him the url and login info. He loves that he's going to be able to see what Spock is doing while he's at his grandpa's house and we're at work.