Using systemd with Domoticz

I wanted to switch from old sysvinit to systemd, I’m starting to like systemd more and more, and I had some issues with Domoticz segfault’ing on me. (I’m always running latest git, so I can hardly blame them.)

What I had to do follows:

Remove the old sysvinit-scripts:
:~# update-rc.d domoticz remove

Move the old init-script away, just in case.
:~# mv /etc/init.d/domoticz ./domoticzinit

Create the new systemd.service, adjust as needed.

:~# editor /lib/systemd/system/domoticz.service

[Unit]
Description=Domoticz Home Automation
After=network.target

[Service]
ExecStart=/home/domo/domoticz/domoticz -daemon -www 8080 -sslwww 443
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target

Enable the new service

:~# systemctl enable domoticz.service

Reboot to verify, or do what makes you confident that this works as intended.

:~# systemctl status domoticz.service

Rejoice, and delete the old init-script.

:~# rm ./domoticzinit

Advertisements

Domoticz, RFXCom and transmit signals

For a long time, I had major issues with sending commands via RFXtrx433 under Domoticz (I think I had the problem with my brief encounter with OpenHAB also.)

I was unable to figure out why, save for the fact that it worked when I first got the RFXtrx433 and tried Domoticz – I therefore assumed the error was “in software”, either with adding the device or a bug in Domoticz.

I recently did some searching on a somewhat-similar issue, and I found a hint on a Homeseer-forum, that if the wrong firmware is loaded, transmit won’t work.

I went straight to www.rfxcom.com and downloaded what I assumed was the correct firmware, making sure it was the type 1 since that was one of the caveats the blogpost noted, and flashed that via Domoticz.
(note, triple-check if that’s what you also need, read the included .txt-file in the firmware-zip.)

After the flash, suddenly it just worked.
I guess I did a bad flash or used the wrong firmware once.

The only error I ever got was: “wrong command received from application” in Domoticz.
If you got that one, searched around and found nothing – you might just need a new firmware.

MotionPie Cam in Domoticz with Motion detection

I wanted to try setting up my Raspberry Pi-camera, and I wanted to integrate it with Domoticz.

I did some manual labor for setting up a dedicated IP-cam from scratch, but after searching around I found MotionPie ( https://github.com/ccrisan/motionPie ).
No point re-inventing the wheel, so I loaded it up according to the installation manual, and got it up network-wise.

The following is needed to be configured in order for Domoticz to work:
IP Address: <ipaddress>
Port:<default-is-80>
Username:<blank>
Password:<blank>
ImageURL:picture/1/current/

If you create a dummy switch in Domoticz, you can have motionpie activate that switch using Motion Notifications:
Enable running of commands, and insert the following command:
curl ‘http://<IP-to-domoticz&gt;:8080/json.htm?type=command&param=switchlight&idx=<IDX>&switchcmd=On’
Where <IP-to-domoticz> is self-explanatory, and <IDX> is the ID-number for the switch.
Don’t forget to edit the switch so it’s a motion sensor, and set a custom off-delay.
MotionPie won’t trigger it “off” for you.