Wednesday 10 March 2021

Home Assistant and Zoneminder troubleshooting

 I've been using Home Assistant for a while, but never really spending a lot of time on it. 

However, as of recently, I've started playing with it a bit more and one of the things that I wanted to do was incorporate my Zoneminder cameras onto the platform.

This is rather easy with a few lines in the configuration.yaml according to the documentation at the Home Assistant page.

zoneminder:

  - host: ZM_HOST

    username: ZM_USER

    password: ZM_PASSWORD

You can add path and path_zms variables if you want.

However, I was having some problems. I kept on getting a json decoder error. 

simplejson.errors.jsondecodeerror: expecting value: line 2 column 1 (char 1)

I initially only had the host, username and password but decided to add the paths. That didn't help. I googled for answers and nothing came up that would suit this.

I couldn't figure out what was going on for a while until I did a tcpdump on the pod and noticed I was getting redirected for certain lines and 404 in others. I then looked at the server longs and that's when I realised, I was hitting the wrong site. 

What I mean is, I run multiple applications on this one host and I was going to the host by IP. I was therefore was getting a different site than intended. At first, I disabled the site to test until it finally clicked. I'm going to the host by IP in my Home Assistant configuration. 

I switched the host value from IP to FQDN and voila! Everything started working.