Wednesday, December 27, 2023

Re: zigbee2mqtt, anyone?

On Wed, Dec 27, 2023 at 12:19:05PM +0000, Mikolaj Kucharski wrote:
> Hi.
>
> - Does anyone has work in progress zigbee2mqtt port?

Not me. I have no experience porting.

> - Does it make sense to try to use it on OpenBSD?

I do. Whether it makes sense or not, is a different matter :)

> - Any hands on experience with zigbee2mqtt on OpenBSD?

Yes. It works fine, AFAICT. Here's what I did:

- pkg_add node

- added a _zigbee2mqtt user similar to other daemon users

- added this user to the 'dialer' group so that it can access the
calling unit (e.g. /dev/cuaU0). This can (and probably should, TBH)
be avoided by changing the device's owner, either permanently or via
hotplugd, but I didn't bother to.

- copied zigbee2mqtt into (a newly created) /usr/local/opt/zigbee2mqtt.

- change the ownership of /usr/local/opt/zigbee2mqtt/* to _zigbee2mqtt

- created /etc/rc.d/zigbee2mqtt with the following contents:

#!/bin/ksh

daemon="/usr/local/bin/node"
daemon_flags="/usr/local/opt/zigbee2mqtt/index.js"
daemon_user=_zigbee2mqtt

. /etc/rc.d/rc.subr

pexp="$(eval echo ${daemon}${daemon_flags:+ ${daemon_flags}})"
rc_bg=YES
rc_reload=NO

rc_cmd $1

- rcctl enable zigbee2mqtt (* see note below)
- rcctl start zigbee2mqtt

And that's it.

* Note that this suffers from the already described problem with node
ports, in that it won't start automatically on boot, but it will start
manually with "rcctl start".

> - If you are using it, are you happy, unhappy, gonna stick to it or not?

Have been using it for a while, and am happy with it. Not so happy with
my setup, because it really should be properly installed/ported, but *I*
didn't bother to. E.g. the 'data' directory is a mess, holding the
configuration files (should be in /etc), logs (/var/log), and the state
and database files (I'd put them somewhere in /var).

> I have zero experience with Zigbee or any home automation,
> that's why I am asking.
>
>
> --
> Regards,
> Mikolaj
>

--

No comments:

Post a Comment