Apt Key Expired in Ubuntu

I was updating my boxes as usual when I encountered an error when trying to run updates on my unifi controller. This lives on a slightly older box (I tried upgrading it at one point and not all the dependencies were supported yet on the newer version), and I ran into an error when running the apt commands. One of the keys was expired for a component needed by the controller. So lets figure out how to update that key so we can update the box once more.

Continue reading “Apt Key Expired in Ubuntu”

Calling HASS API from Various Shells

While working on making my macro pad trigger Home Assistant automations, I found the API would be the easiest way to integrate the systems. Here’s some of my experimenting with the API and how to call it from Linux curl and PowerShell Invoke-WebRequest

Linux Curl

Using the Linux curl command is pretty straight forward.

curl -X POST http://hass.local:8123/api/services/switch/toggle -H 'Authorization: Bearer ABCDEF' -d '{"entity_id": "switch.testsubject_test_subject"}'

PowerShell Invoke-WebRequest

PowerShell is a bit more annoying to get everything right, as Invoke-WebRequest is a bit pickier on its input arguments.

Invoke-WebRequest -Method POST -Uri "http://hass.local:8123/api/services/switch/toggle" -H @{"Authorization"="Bearer ABCDEF"} -Body '{"entity_id": "switch.testsubject_test_subject"}'

Apparently windows has a build of the official Unix curl and tar commands, but my PowerShell prompts all had curl as an alias to Invoke-WebRequest. I did find that if i call curl.exe, it would run the official curl command.

Conclusion

Do be careful when copying and pasting between shells, I found that copying out of the PowerShell prompt and back in would yield an invalid token. This was also encountered in the WSL terminal as well.

The API is pretty straight forward after a little bit of trying things out. The documentation covers the capability but doesn’t have as many examples as I would have liked otherwise.

Resources

WLED Automation for Roku in Home Assistant

I was able to get WLED going on a light strip but I do have a lack of ideas on how to make use of it. I finally decided to go with the tried and true movie lighting. So my goal is to setup automations so that when my Roku begins playing something, the WLED strip dims and sets to a specific color (we’ll go with red), and when I pause or stop playing, it will turn to max brightness white light. This will give lower lighting while watching and brighter lights if something is paused (and I have to go get something). I’m still not entirely sure if I will end up making use of this in the end, but it will give me some ideas on what I can do and how to do it.

Continue reading “WLED Automation for Roku in Home Assistant”

NextCloud File Lock Error in Joplin

I encountered a problem recently on the Joplin desktop app where it couldn’t synchronize due to a file lock being stuck in NextCloud. It uses a file in the jopline data directories to determine sync status and lock status on files being edited, and this file was stuck locked in NextCloud with no way to delete it. I performed some searching, finding some blog posts on the subject and found this on how to solve it. I’ll be going through the manual solution to this problem and updating the process with my experience.

Continue reading “NextCloud File Lock Error in Joplin”

WLED with ESP8266

I found a guide for running WLED on an ESP8266 micro controller to drive individually addressable RGB cables. I thought this would be a fun little project after working with the smart plugs and home assistant automations. Since WLED is another FOSS and cloud-free project, this still fits with my whole fully self hosted smart home ideal. Since no project is fool proof and I have run into small problems when working on the project.

Continue reading “WLED with ESP8266”

Adding a Current Month Numeric Sensor to Home Assistant

I have a number of Christmas light strands in various windows around my house. These get turned on once a year when we remember they exist and its around Christmas time. I decided that these would be a good use for home assistant to add some Christmas lighting during November and December.

To do this, I wanted an automation that would turn on the lights during specific months, and not during others. Thus I needed the current month available as a condition for my automation. I quickly found out that Home Assistant does not have this type of data built in, but can have it added relatively easily. I didn’t know how most of this was supposed to go together, so after a little bit of guess and check, here is what I ended up with.

Continue reading “Adding a Current Month Numeric Sensor to Home Assistant”

PhotoPrism MySQL DSN

Setting up the service was simple enough, I chose to run it on my UNRAID server however this meant I couldn’t use the example docker-compose file. I took all the settings from it and set it all up on my UNRAID server with the only changes being to paths for my file structure and the SQL database information. I use a MySQL database server for most of my services, so I needed to get the DSN for that server, however this was the first time I used DSNs, however it is pretty simple to setup correctly. I used PHPmyAdmin to add a user and database for PhotoPrism, and from there I used the default DSN with my username/password and host/port information

<user>:<password>@tcp(192.168.1.11:3306)/<databaseName>?charset=utf8mb4,utf8&parseTime=true

After that, everything was simple to setup and use. I logged in and was ready to start ingesting images.

Configuring PhotoPrism with NextCloud Sync

PhotoPrism is easy to setup with NextCloud sync, though it seems a bit odd the way its done. The NextCloud server is added to Settings / Backup in PhotoPrism, then you can click the circular arrows under the sync heading, and setup sync. To pick up the NextCloud auto uploads from my phone, I selected the InstantUploads folder to sync, with a daily interval. I told PhotoPrism to download remote files, preserve filenames, and sync raw and video files. I didn’t want PhotoPrism to upload to NextCloud as I wanted it to be a one way file sync to gather data. My PhotoPrism server is setup as a data viewer and not generating data itself as well. Then a flip of the “enable” switch and its complete. The first sync didn’t start instantaneously, however it did start not too long after setting it up, and it took a few hours to slowly sync and process all the files in my NextCloud folder (a few thousand files).