lundi 27 novembre 2023

Orange PI 5 + Domoticz + rtl_433

Compile dev_domoticz from sources :

https://www.domoticz.com/wiki/Build_Domoticz_from_source


Install rtl_433 :

sudo apt-get install rtl-433

sudo rtl_433


Using systemd service:


sudo nano /etc/systemd/system/domoticz.service



[Unit]

      Description=domoticz_service

      After=network-online.target

[Service]

#      User=dietpi

#      Group=dietpi

#      PermissionsStartOnly=true

      WorkingDirectory=/home/pi5/dev-domoticz

      PIDFILE=/var/run/domoticz/domoticz.pid

      ExecStartPre=-/usr/bin/killall -q rtl_433

#      ExecStartPre=/usr/bin/install -d -m 0700 -o pi5 -g PI5 /var/run/domoticz

      ExecStartPre=setcap 'cap_net_bind_service=+ep' /home/pi5/dev-domoticz/domoticz

      ExecStart=/home/pi5/dev-domoticz/domoticz -www 80 -sslwww 443 -pidfile /var/run/domoticz/domoticz.pid

      Restart=on-failure

      RestartSec=1m

      #StandardOutput=null

[Install]

      WantedBy=multi-user.target


sudo systemctl enable domoticz

sudo systemctl daemon-reload

sudo systemctl restart domoticz

sudo service domoticz status


● domoticz.service - domoticz_service

     Loaded: loaded (/etc/systemd/system/domoticz.service; enabled; vendor preset: enabled)

     Active: active (running) since Mon 2023-11-27 09:49:56 CET; 3h 26min ago

    Process: 64410 ExecStartPre=/usr/bin/killall -q rtl_433 (code=exited, status=1/FAILURE)

    Process: 64411 ExecStartPre=setcap cap_net_bind_service=+ep /home/pi5/dev-domoticz/domoticz (code=exited, status=0/SUC>

   Main PID: 64412 (domoticz)

      Tasks: 27 (limit: 4149)

     Memory: 27.4M

        CPU: 25min 18.524s

     CGroup: /system.slice/domoticz.service

             ├─64412 /home/pi5/dev-domoticz/domoticz -www 80 -sslwww 443 -pidfile /var/run/domoticz/domoticz.pid

             ├─64440 sh -c "rtl_433 -F json -M newmodel -C si -M level  2>/dev/null"

             └─64441 rtl_433 -F json -M newmodel -C si -M level


Orange PI 5 + GPIO

sudo apt-get update
sudo apt-get install -y git
git clone https://github.com/orangepi-xunlong/wiringOP.git
cd wiringOP
sudo ./build clean
sudo ./build 

If you got something like :

Oops: Unable to determine board revision from /etc/orangepi-release or /etc/armbian-release.

 -> Unable to open /etc/orangepi-release or /etc/armbian-release.

 ->  You'd best google the error to find out why.


echo "BOARD=orangepi5" | sudo tee /etc/orangepi-release

gpio readall
 +------+-----+----------+--------+---+   OPI5   +---+--------+----------+-----+------+
 | GPIO | wPi |   Name   |  Mode  | V | Physical | V |  Mode  | Name     | wPi | GPIO |
 +------+-----+----------+--------+---+----++----+---+--------+----------+-----+------+
 |      |     |     3.3V |        |   |  1 || 2  |   |        | 5V       |     |      |
 |   47 |   0 |    SDA.5 |     IN | 1 |  3 || 4  |   |        | 5V       |     |      |
 |   46 |   1 |    SCL.5 |     IN | 1 |  5 || 6  |   |        | GND      |     |      |
 |   54 |   2 |    PWM15 |     IN | 1 |  7 || 8  | 0 | IN     | RXD.0    | 3   | 131  |
 |      |     |      GND |        |   |  9 || 10 | 0 | IN     | TXD.0    | 4   | 132  |
 |  138 |   5 |  CAN1_RX |     IN | 1 | 11 || 12 | 1 | IN     | CAN2_TX  | 6   | 29   |
 |  139 |   7 |  CAN1_TX |     IN | 1 | 13 || 14 |   |        | GND      |     |      |
 |   28 |   8 |  CAN2_RX |     IN | 1 | 15 || 16 | 1 | IN     | SDA.1    | 9   | 59   |
 |      |     |     3.3V |        |   | 17 || 18 | 1 | IN     | SCL.1    | 10  | 58   |
 |   49 |  11 | SPI4_TXD |     IN | 1 | 19 || 20 |   |        | GND      |     |      |
 |   48 |  12 | SPI4_RXD |     IN | 1 | 21 || 22 | 1 | IN     | GPIO2_D4 | 13  | 92   |
 |   50 |  14 | SPI4_CLK |     IN | 1 | 23 || 24 | 1 | IN     | SPI4_CS1 | 15  | 52   |
 |      |     |      GND |        |   | 25 || 26 | 1 | IN     | PWM1     | 16  | 35   |
 +------+-----+----------+--------+---+----++----+---+--------+----------+-----+------+
 | GPIO | wPi |   Name   |  Mode  | V | Physical | V |  Mode  | Name     | wPi | GPIO |
 +------+-----+----------+--------+---+   OPI5   +---+--------+----------+-----+------+