Witam.
Próbowałem przeszukać forum, ale nie znalazłem podobnego problemu.
Raspberry Pi 3 B + przekaźnik + kontaktron
Przekaźnik w konfigu ustawiony jako RELAYHFD4, kontaktron jako SENSORNC. Wszystko działa poprawnie - brama garażowa się zamyka/otwiera. Ikonka w aplikacji zmienia się prawidłowo na podstawie odczytu stanu kontaktrona. Aż do momentu restartu maliny.
Po restarcie działa otwieranie/zamykanie bramy, ale aplikacja nie widzi stanu sensora.
Pomaga usunięcie urządzenia z cloud.supla.org i ponowna rejestracja. wtedy sensor jest znowu prawidłowo odczytywany.
Ale może jest jakieś rozwiązanie, by nie robić tego przy każdym restarcie raspberry?
Raspberry pi supla-dev missing sensor state after reboot
-
Klimek_PL
- Posts: 8
- Joined: Tue May 25, 2021 9:11 pm
Mam takie wpisy w crontab , gdzie najpierw ustawiany jest stan pinu, w moim przypadku 18 BCMpzygmunt wrote: Wed May 26, 2021 8:08 am Sprawdź najpierw stan portu GPIO jak wystąpi taki problem.
[edit] czy port czujnika masz podciągnięty rezystorem do
GND ?
@reboot sleep 20 &&
/usr/bin/gpio -g mode 18 in
następnie uruchamiany jest rezystor podciągający na tym pinie:
/usr/bin/gpio -g mode 18 up
W tym momencie jest stan to 0 czyli sensor jest zwarty, a mimo to ikona w aplikacji prezentuje podniesioną bramę, nie zależnie od tego czy jest podniesiona i czy nie.
Sprawdzałem przez gpio -g read 18 i stan się zmienia na 1 przy rozwarcia kontaktronu i wraca na 0 w przypadku zwarcia.
Tak jak pisałem wcześniej, bez żadnej zmiany w konfiguracji, wystarczy że usunę urządzenie z cloud.supla.org i zarejestruję ponownie i ikona w aplikacji zaczyna prawidłowo odczytywać stan sensora.
Sensor zwarty z drugiej strony do GND maliny.
-
Klimek_PL
- Posts: 8
- Joined: Tue May 25, 2021 9:11 pm
To może inaczej, supla.cfg wygląda tak:pzygmunt wrote: Wed May 26, 2021 12:59 pm Tego nie powinieneś ruszać w crontab-ie. Supla-dev sama sobie konfiguruje porty.
Tam masz mieć pulldown, a nie pullup.
Code: Select all
[CHANNEL_0]
type=RELAYHFD4
gpio1=26
[CHANNEL_1]
type=SENSORNC
gpio1=18
Code: Select all
+-----+-----+---------+------+---+---Pi 3B+-+---+------+---------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| | | 3.3v | | | 1 || 2 | | | 5v | | |
| 2 | 8 | SDA.1 | IN | 1 | 3 || 4 | | | 5v | | |
| 3 | 9 | SCL.1 | IN | 1 | 5 || 6 | | | 0v | | |
| 4 | 7 | GPIO. 7 | IN | 1 | 7 || 8 | 0 | IN | TxD | 15 | 14 |
| | | 0v | | | 9 || 10 | 1 | IN | RxD | 16 | 15 |
| 17 | 0 | GPIO. 0 | IN | 0 | 11 || 12 | 0 | IN | GPIO. 1 | 1 | 18 |
| 27 | 2 | GPIO. 2 | IN | 0 | 13 || 14 | | | 0v | | |
| 22 | 3 | GPIO. 3 | IN | 0 | 15 || 16 | 0 | IN | GPIO. 4 | 4 | 23 |
| | | 3.3v | | | 17 || 18 | 0 | IN | GPIO. 5 | 5 | 24 |
| 10 | 12 | MOSI | IN | 0 | 19 || 20 | | | 0v | | |
| 9 | 13 | MISO | IN | 0 | 21 || 22 | 0 | IN | GPIO. 6 | 6 | 25 |
| 11 | 14 | SCLK | IN | 0 | 23 || 24 | 1 | IN | CE0 | 10 | 8 |
| | | 0v | | | 25 || 26 | 1 | IN | CE1 | 11 | 7 |
| 0 | 30 | SDA.0 | IN | 1 | 27 || 28 | 1 | IN | SCL.0 | 31 | 1 |
| 5 | 21 | GPIO.21 | IN | 1 | 29 || 30 | | | 0v | | |
| 6 | 22 | GPIO.22 | IN | 1 | 31 || 32 | 0 | IN | GPIO.26 | 26 | 12 |
| 13 | 23 | GPIO.23 | IN | 1 | 33 || 34 | | | 0v | | |
| 19 | 24 | GPIO.24 | IN | 1 | 35 || 36 | 1 | IN | GPIO.27 | 27 | 16 |
| 26 | 25 | GPIO.25 | IN | 1 | 37 || 38 | 1 | IN | GPIO.28 | 28 | 20 |
| | | 0v | | | 39 || 40 | 1 | IN | GPIO.29 | 29 | 21 |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+---------+------+---+---Pi 3B+-+---+------+---------+-----+-----+
i dostaję komunikat:
Code: Select all
ERR[1622113794.545875] Can't set GPIO port parameters. Port number 26
ERR[1622113794.547405] Can't set GPIO port parameters. Port number 18
Code: Select all
+-----+-----+---------+------+---+---Pi 3B+-+---+------+---------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| | | 3.3v | | | 1 || 2 | | | 5v | | |
| 2 | 8 | SDA.1 | IN | 1 | 3 || 4 | | | 5v | | |
| 3 | 9 | SCL.1 | IN | 1 | 5 || 6 | | | 0v | | |
| 4 | 7 | GPIO. 7 | IN | 1 | 7 || 8 | 0 | IN | TxD | 15 | 14 |
| | | 0v | | | 9 || 10 | 1 | IN | RxD | 16 | 15 |
| 17 | 0 | GPIO. 0 | IN | 0 | 11 || 12 | 0 | IN | GPIO. 1 | 1 | 18 |
| 27 | 2 | GPIO. 2 | IN | 0 | 13 || 14 | | | 0v | | |
| 22 | 3 | GPIO. 3 | IN | 0 | 15 || 16 | 0 | IN | GPIO. 4 | 4 | 23 |
| | | 3.3v | | | 17 || 18 | 0 | IN | GPIO. 5 | 5 | 24 |
| 10 | 12 | MOSI | IN | 0 | 19 || 20 | | | 0v | | |
| 9 | 13 | MISO | IN | 0 | 21 || 22 | 0 | IN | GPIO. 6 | 6 | 25 |
| 11 | 14 | SCLK | IN | 0 | 23 || 24 | 1 | IN | CE0 | 10 | 8 |
| | | 0v | | | 25 || 26 | 1 | IN | CE1 | 11 | 7 |
| 0 | 30 | SDA.0 | IN | 1 | 27 || 28 | 1 | IN | SCL.0 | 31 | 1 |
| 5 | 21 | GPIO.21 | IN | 1 | 29 || 30 | | | 0v | | |
| 6 | 22 | GPIO.22 | IN | 1 | 31 || 32 | 0 | IN | GPIO.26 | 26 | 12 |
| 13 | 23 | GPIO.23 | IN | 1 | 33 || 34 | | | 0v | | |
| 19 | 24 | GPIO.24 | IN | 1 | 35 || 36 | 1 | IN | GPIO.27 | 27 | 16 |
| 26 | 25 | GPIO.25 | OUT | 0 | 37 || 38 | 1 | IN | GPIO.28 | 28 | 20 |
| | | 0v | | | 39 || 40 | 1 | IN | GPIO.29 | 29 | 21 |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+---------+------+---+---Pi 3B+-+---+------+---------+-----+-----+
-
pzygmunt
- Posts: 20302
- Joined: Tue Jan 19, 2016 9:26 am
- Location: Paczków
- Been thanked: 59 times
-
Klimek_PL
- Posts: 8
- Joined: Tue May 25, 2021 9:11 pm
Code: Select all
pi@raspberrypi:~/supla/supla-core/supla-dev/src $ gcc gpio.c -o gpio
/usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/8/../../../aarch64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x18): undefined reference to `main'
/usr/bin/ld: (.text+0x1c): undefined reference to `main'
/usr/bin/ld: /tmp/ccwzJtr1.o: in function `gpio_set_value':
gpio.c:(.text+0x594): undefined reference to `supla_log'
/usr/bin/ld: /tmp/ccwzJtr1.o: in function `gpio_port_init':
gpio.c:(.text+0x834): undefined reference to `st_file_exists'
/usr/bin/ld: gpio.c:(.text+0x88c): undefined reference to `st_file_exists'
/usr/bin/ld: gpio.c:(.text+0x8b0): undefined reference to `supla_log'
/usr/bin/ld: gpio.c:(.text+0x934): undefined reference to `supla_log'
collect2: error: ld returned 1 exit status
-
Klimek_PL
- Posts: 8
- Joined: Tue May 25, 2021 9:11 pm
Wynik kompilacji poniżej:pzygmunt wrote: Thu May 27, 2021 12:15 pm Tak nie skompilujesz.
cd supla-dev/Debug/
make clean
make all
Code: Select all
pi@raspberrypi:~/supla/supla-core/supla-dev/Debug $ make clean
rm -rf ./src/accept_loop.o ./src/cfg.o ./src/channel-io.o ./src/common_dht_read.o ./src/devcfg.o ./src/devconnection.o ./src/eh.o ./src/gpio.o ./src/ini.o ./src/ipcctrl.o ./src/ipcsocket.o ./src/lck.o ./src/log.o ./src/mcp23008.o ./src/pi_2_dht_read.o ./src/pi_2_mmio.o ./src/proto.o ./src/safearray.o ./src/srpc.o ./src/sthread.o ./src/supla-dev.o ./src/supla-socket.o ./src/tools.o ./src/w1.o ./src/cfg.d ./src/channel-io.d ./src/common_dht_read.d ./src/devcfg.d ./src/devconnection.d ./src/eh.d ./src/gpio.d ./src/ini.d ./src/ipcsocket.d ./src/lck.d ./src/log.d ./src/mcp23008.d ./src/pi_2_dht_read.d ./src/pi_2_mmio.d ./src/proto.d ./src/safearray.d ./src/srpc.d ./src/sthread.d ./src/supla-socket.d ./src/tools.d ./src/w1.d ./src/accept_loop.d ./src/ipcctrl.d ./src/supla-dev.d supla-dev
pi@raspberrypi:~/supla/supla-core/supla-dev/Debug $ make all
Building file: ../src/accept_loop.cpp
Invoking: Cross G++ Compiler
g++ -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/accept_loop.d" -MT"src/accept_loop.o" -o "src/accept_loop.o" "../src/accept_loop.cpp"
Finished building: ../src/accept_loop.cpp
Building file: ../src/cfg.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/cfg.d" -MT"src/cfg.o" -o "src/cfg.o" "../src/cfg.c"
Finished building: ../src/cfg.c
Building file: ../src/channel-io.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/channel-io.d" -MT"src/channel-io.o" -o "src/channel-io.o" "../src/channel-io.c"
Finished building: ../src/channel-io.c
Building file: ../src/common_dht_read.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/common_dht_read.d" -MT"src/common_dht_read.o" -o "src/common_dht_read.o" "../src/common_dht_read.c"
Finished building: ../src/common_dht_read.c
Building file: ../src/devcfg.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/devcfg.d" -MT"src/devcfg.o" -o "src/devcfg.o" "../src/devcfg.c"
Finished building: ../src/devcfg.c
Building file: ../src/devconnection.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/devconnection.d" -MT"src/devconnection.o" -o "src/devconnection.o" "../src/devconnection.c"
Finished building: ../src/devconnection.c
Building file: ../src/eh.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/eh.d" -MT"src/eh.o" -o "src/eh.o" "../src/eh.c"
Finished building: ../src/eh.c
Building file: ../src/gpio.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/gpio.d" -MT"src/gpio.o" -o "src/gpio.o" "../src/gpio.c"
Finished building: ../src/gpio.c
Building file: ../src/ini.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/ini.d" -MT"src/ini.o" -o "src/ini.o" "../src/ini.c"
Finished building: ../src/ini.c
Building file: ../src/ipcctrl.cpp
Invoking: Cross G++ Compiler
g++ -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/ipcctrl.d" -MT"src/ipcctrl.o" -o "src/ipcctrl.o" "../src/ipcctrl.cpp"
Finished building: ../src/ipcctrl.cpp
Building file: ../src/ipcsocket.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/ipcsocket.d" -MT"src/ipcsocket.o" -o "src/ipcsocket.o" "../src/ipcsocket.c"
Finished building: ../src/ipcsocket.c
Building file: ../src/lck.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/lck.d" -MT"src/lck.o" -o "src/lck.o" "../src/lck.c"
Finished building: ../src/lck.c
Building file: ../src/log.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/log.d" -MT"src/log.o" -o "src/log.o" "../src/log.c"
Finished building: ../src/log.c
Building file: ../src/mcp23008.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/mcp23008.d" -MT"src/mcp23008.o" -o "src/mcp23008.o" "../src/mcp23008.c"
Finished building: ../src/mcp23008.c
Building file: ../src/pi_2_dht_read.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/pi_2_dht_read.d" -MT"src/pi_2_dht_read.o" -o "src/pi_2_dht_read.o" "../src/pi_2_dht_read.c"
Finished building: ../src/pi_2_dht_read.c
Building file: ../src/pi_2_mmio.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/pi_2_mmio.d" -MT"src/pi_2_mmio.o" -o "src/pi_2_mmio.o" "../src/pi_2_mmio.c"
Finished building: ../src/pi_2_mmio.c
Building file: ../src/proto.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/proto.d" -MT"src/proto.o" -o "src/proto.o" "../src/proto.c"
Finished building: ../src/proto.c
Building file: ../src/safearray.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/safearray.d" -MT"src/safearray.o" -o "src/safearray.o" "../src/safearray.c"
Finished building: ../src/safearray.c
Building file: ../src/srpc.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/srpc.d" -MT"src/srpc.o" -o "src/srpc.o" "../src/srpc.c"
Finished building: ../src/srpc.c
Building file: ../src/sthread.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/sthread.d" -MT"src/sthread.o" -o "src/sthread.o" "../src/sthread.c"
Finished building: ../src/sthread.c
Building file: ../src/supla-dev.cpp
Invoking: Cross G++ Compiler
g++ -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/supla-dev.d" -MT"src/supla-dev.o" -o "src/supla-dev.o" "../src/supla-dev.cpp"
Finished building: ../src/supla-dev.cpp
Building file: ../src/supla-socket.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/supla-socket.d" -MT"src/supla-socket.o" -o "src/supla-socket.o" "../src/supla-socket.c"
../src/supla-socket.c: In function âssocket_client_initctxâ:
../src/supla-socket.c:209:3: warning: âTLSv1_2_client_methodâ is deprecated [-Wdeprecated-declarations]
method = (SSL_METHOD *)TLSv1_2_client_method();
^~~~~~
In file included from /usr/include/openssl/e_os2.h:13,
from /usr/include/openssl/err.h:13,
from ../src/supla-socket.c:42:
/usr/include/openssl/ssl.h:1891:1: note: declared here
DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_client_method(void))
^~~~~~~~~~~~~~~~~~
../src/supla-socket.c: In function âssocket_freeâ:
../src/supla-socket.c:306:5: warning: âERR_remove_thread_stateâ is deprecated [-Wdeprecated-declarations]
ERR_remove_thread_state(NULL);
^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/e_os2.h:13,
from /usr/include/openssl/err.h:13,
from ../src/supla-socket.c:42:
/usr/include/openssl/err.h:260:1: note: declared here
DEPRECATEDIN_1_1_0(void ERR_remove_thread_state(void *))
^~~~~~~~~~~~~~~~~~
../src/supla-socket.c: In function âssocket_supla_socket_closeâ:
../src/supla-socket.c:446:5: warning: âERR_remove_thread_stateâ is deprecated [-Wdeprecated-declarations]
ERR_remove_thread_state(NULL);
^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/e_os2.h:13,
from /usr/include/openssl/err.h:13,
from ../src/supla-socket.c:42:
/usr/include/openssl/err.h:260:1: note: declared here
DEPRECATEDIN_1_1_0(void ERR_remove_thread_state(void *))
^~~~~~~~~~~~~~~~~~
Finished building: ../src/supla-socket.c
Building file: ../src/tools.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/tools.d" -MT"src/tools.o" -o "src/tools.o" "../src/tools.c"
Finished building: ../src/tools.c
Building file: ../src/w1.c
Invoking: Cross GCC Compiler
gcc -I/usr/src/openssl/include -O0 -g3 -Wall -fsigned-char -c -fmessage-length=0 -MMD -MP -MF"src/w1.d" -MT"src/w1.o" -o "src/w1.o" "../src/w1.c"
Finished building: ../src/w1.c
Building target: supla-dev
Invoking: Cross G++ Linker
g++ -L/usr/src/openssl/lib -pthread -lrt -o "supla-dev" ./src/accept_loop.o ./src/cfg.o ./src/channel-io.o ./src/common_dht_read.o ./src/devcfg.o ./src/devconnection.o ./src/eh.o ./src/gpio.o ./src/ini.o ./src/ipcctrl.o ./src/ipcsocket.o ./src/lck.o ./src/log.o ./src/mcp23008.o ./src/pi_2_dht_read.o ./src/pi_2_mmio.o ./src/proto.o ./src/safearray.o ./src/srpc.o ./src/sthread.o ./src/supla-dev.o ./src/supla-socket.o ./src/tools.o ./src/w1.o -lssl -lcrypto
Finished building target: supla-dev
