Permissions of /dev/ttyUSBMySensorsGateway



  • Dear All,
    thank you for all the work done and all the help in advance. I have a hassbian controller and gateway working nicely with MySensors 2.2. I am happy.

    One annoyance with the RPi gateway are the permissions of /dev/ttyUSBMySensorsGateway, which are by default owned by root and the root group. Modifying the permissions manually allows Home Assistant to happily read messages from the serial port until the next reboot (sudo chmod 777 /dev/ttyUSBMySensorsGateway).

    How do you manage this? Ideally I would add the user homeassistant to the dialout group but this would not help because the group of this serial port is root, if I got it right. Likely this is a problem of udev rules. But how do you manage it?

    I will put my setup on github as soon as it's cleaned up and tell you about it. Good stuff.

    Thanks for the advice.

    Cheers
    Brian


  • Admin

    You can probably add a udev rule in /etc/udev/rules.d/


  • Mod

    @oneyb you should be able to use

    --my-serial-groupname=<GROUP>
    

    in the configure command to allow access to a group that the Home assistant user is member of.



  • Thank you @hek and @mfalkvidd for the quick replies! I did not receive a notification, so I had no idea anyone had had a look.

    @mfalkvidd, indeed I like the group solution and just missed that option. Because I occasionally upload firmware with my Pi, I have the group 'dialout', which suits this purpose well. So, I tried it and it worked like a charm. I think that should be mentioned on the install page.

    For the record:

    ./configure  --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyUSBMySensorsGateway --my-transport=nrf24 --my-rf24-irq-pin=15 --my-serial-groupname=dialout
    make
    

    I try to keep everything documented how I do things (for myself). I have an ansible playbook in my RPi ansible management repository.

    For my configuration, please see:
    https://github.com/oneyb/rpi-embed-dev/blob/master/install-mysensors-gateway-raspberry.yaml

    Thanks again!


  • Mod

    @oneyb thanks for your suggestion, and sorry for the late reply.

    I worry that the install page is large enough as it is. People tend to be afraid of long texts, and just ignore stuff if there is too much text. Therefore, we try to keep the guides as minimal as possible, but still covering the most common cases. The full documentation is still available for those who want to dive deeper. If you have any idea on how to handle it differently, you're very welcome to speak up.


 

324
Online

7.8k
Users

8.7k
Topics

93.0k
Posts