Setting up Z-Wave in Home Assistant on Proxmox

Recently I have ended up with 2 Z-Wave devices in my home, and while the devices work just fine without it enabled, I wanted to mess around with them in home assistant. I’ve seen lots of information on Z-Wave and Zigbee devices and sensors and had been looking at getting some anyway, so I used this as a reason to jump in.

Since I run Home Assistant on a VM via Proxmox, my setup will end up being a bit different than the usual “just plug in the USB Z-Wave controller and go” for those running Home Assistant on a Raspberry Pi or NUC.

Continue reading “Setting up Z-Wave in Home Assistant on Proxmox”

NextCloud “Maintenance” Mode Error Resolution

For a while my NextCloud server decided to stop allowing my phone or desktop to upload to it due to it being in “maintenance mode”, however I could log into the webui with no problems, and nothing in the logs showed it being in maintenance mode. This started to frustrate me as I could find nothing to signify why my clients thought the server couldn’t be used. I tried a number of things:

  • Clearing out the file locks table (there were 600,000 entries in it, and I’m the only user on the server)
  • occ db:add-missing-columns
  • occ db:add-missing-indices
  • occ db:add-missing-primary-keys
    What finally worked:
  • occ files:scan –all

Finally with the files:scan –all it started working again and my app was able to start uploading to the server. If you have a NextCloud server and have been running into “maintenance mode” errors when your server is not in maintenance mode, this is certainly worth trying.

Some GitHub Issues worth checking:

Time Lapse 3d print

I wanted to create a time lapse of a 3D print however I wasn’t sure the best way to do this. I’ve made time lapses using octoprint before, but for that to work, octoprint needed to be the machine driving the printer. I tend to prefer running my Ultimaker from the SD card as I’ve forgotten what all my previous octoprint settings were to get it running as smoothly as the Cura settings from the card. I also wanted to work on a more generic way to create a time lapse.

Continue reading “Time Lapse 3d print”

BlueIris and the No Signal Camera

I recently setup a few new cameras on my BlueIris box, however one camera in particular was giving me problems. I tried a few different configurations and each time I got a no signal error. I could change the IP to another camera and all was well, but this one in particular was angry at me. I could log into the web interface and view the feeds, so I knew it was working, it just had something up in the configuration. I ended up looking at the Blue Iris status UI to see that I was getting about 1.5FPS through with a slightly lower bitrate than the camera was configured to at the time. I updated the camera config to drop the bitrate and voila, signal, smooth video.

The root cause is something in the cable, either too much interference from AC wiring, or an end isn’t as well crimped as it could be. Either way, I got my camera up in my Blue Iris instance and things worked fine after that.

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.

Goals:

  • Adjust lighting when Roku plays some media
    • If light is on, dim when playing
    • If light is on, brighten and go to white when paused or stopped
  • Change to solid colors and a specific color
  • When the Roku goes to Idle, turn the light strip off

Plan

The Roku integration has a number of different statuses, however we’ll be focusing on 3 of them:

  • idle
  • playing
  • paused

For our automations, we’ll be looking for changes in status in the following ways:

  • any status to playing
  • any status to idle
  • playing to any status

The plan is to create an automation for each one of these status changes. And each of those automations will perform the actions we have listed in the goals. To do this, we’ll be making use of the Roku and WLED integrations as well as the WLED webui for creating presets.

Setup

Setting everything up starts on the WLED webui side of things. This is where presets can be added to the device and various settings can be changed on the fly. We will be adding two presets for our set of automations (bright white and dim red). I did this on a desktop, so with the webui all the way open, it was on the far right side. I first set the LED strip to the settings I wanted the preset to use, then I clicked to add a new preset. Doing this twice got me the two presets.

Do make sure to note the presets numbers since this will be used to call up the presets when used in the automations later on.

Those presets can be called by the HASS automation to set things a bit more specifically than the HASS service will allow. The presets allow setting the solid color to use which I didn’t see as an option using the home assistant WLED service.

Dim when Playing

The first automation in our set of 3 is to dim the lights when the Roku starts playing some content.

Trigger:

The trigger for dimming the lights uses a state change from any state to ‘playing’. Since we don’t care about the original state, we leave the ‘from’ field blank, essentially acting as a wildcard, and we set the ‘to’ field to ‘playing’. This trigger will work when going from paused to playing, from an app to playing, etc.

Condition:

The condition here is that the LED strip is already on. If the LED strip is off, we do not want to turn it on and start manipulating it.

Actions:

It may seem a bit strange that we’re turning on the light as the action here when we already know its on, but it was the most straight forward way I could find to set the brightness on the light strip.

After turning the lights on, we want to set the lights to a solid color and call the preset to our dim red preset. I realize this could all be performed using the preset, but this is in part a relic of my experimenting with the automations. This can probably be simplified into the preset to handle the brightness, effect, and color.

The final (and only really necessary) action is to call a service with one argument to the light strip. The argument is the preset number that was created in the webui of WLED.

Turn Bright when Paused

The second automation in this grouping is to turn the lights up when pausing the video.

Trigger:

The trigger for turning up the lights when the media is paused is similar to the others. This time we want the state to change from playing to anything else. Due to this, we’re just using the ‘from’ field.

Condition:

We only want to adjust the lights when they’re on, if we turn them off then we don’t want to be manipulating them.

Action:

The action for this automation is simple enough, we just need to set the light strip to the preset. This is a service call with one argument to the light strip.

Turn off When Idle

The final automation for this setup is to turn the lights off when the Roku goes idle. The idle state is when they Roku goes to the screensaver. In this automation, we’re not going to use the condition that the light strip is on, since if it is on or off, turning it off will have the exact same effect.

Trigger:

The trigger for turning off the lights when the Roku goes idle is similar to the others. This time we want the state to change from anything to idle. Due to this, we’re just using the ‘to’ field.

Action:

The action is simple to setup, we just want to turn off the light strip.

Testing and Changes to Plans

I went to play and pause the Roku far more times than I expected. Using the testing is how I found my sun condition of before sunrise and after sunset was causing problems. It took a few tries to figure out the right status settings for the automation. Below is the failed Sun condition that I tried to use.

Since this condition did not work, I decided to create a different condition, that the WLED strip is on already before manipulating it. Since the goal Sun condition was to manipulate the lights only at night, I decided that using the lights on/off status would be a good compromise and fit the same goal. I can just say ‘well if the lights are on already, then start manipulating them’.

Conclusion

This was a fun project to get some automation experience with WLED. I didn’t have the light strip setup with my TV as I hadn’t yet decided how I was going to use it, I just wanted to know what I could do. This does however work pretty well. This also gave me some other knowledge on the automations, triggers, and actions.

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”