Neues Modul: Signalbot (Integration für den Signal Messenger) via signal-cli

Begonnen von Adimarantis, 31 Januar 2021, 19:16:19

Vorheriges Thema - Nächstes Thema

HarryT

Hi Tamash

I have the impression you didn´t remove the old installation.

I would use:
Zitat- ./signal_install.sh remove
to remove the installation

Zitat- rm -r /opt/signal
to remove libs etc which where previous installed
FHEM 6.2 auf Raspberry Pi3  (1,2 Ghz)
RFXTRX433XL, ZWave, KFL200 and ConBeeIII
Raspberry Pi1 (0,7 Ghz) and Raspberry Pi4 for testing
German reading skills are good.

HarryT

I have problems with registering an account.

If I follow the procedure I get in the chromium console:
Navigeren naar 'signalcaptcha://signal-hcaptcha.30b01b46-d8c9-4c30-bbd7-9719acfe0c10.registration.P1_eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.hKdwYXNza2V5xQPQoCt_Ev66wdrP0DlpNEp54VnOWigpXaUDgFlK2SsuDEeIYD4aoBh8ySQKiKV_0Mvfb6WzhvgOJNZf3FNFvfP0UhpO0yeDtvTtwXO4bNwdZpXVRCpY91MtAH06VV0xuu1zI441tVjeoFO4m4s5j-v_weOAFv3xNxy_PRQWbuA7qP97Hey3gcI8MZUq0YaeAuDgGDeJQNr1Q9r3daVc8eKT6DfPXRzTr5t_OFQUJiMOf_zSEyagNUsGcl64inETnhlIfYnGkwzGV102rIdgG_oFHwwezd6KIW066OW4xFf8E2ZRXtrPeWF6n_7qr-6x4ZUqkNOGLbvAEyJetvfLwGcYvbO-uvDUFHqgfiZcDyuH7m5n_pquLrqStvcSrtcINy5EgBAl9Dx6hJhMMU7DqVkX3oubzFxQ5RI2nXV3sEo78Lpg1GeN7kPSeEpDtXL0TdghAFURzkkRDujg_OJ8NyIqWSGhE5Rr_L15F7eS5uDborSVDaZQU2493fKdm1uC9SsiW39aJZmWCs9q-JrEXzOWgqswKFTHvPvCrZkfXB9YeO5wMZNevmad06vpdPe9WK8hxq1d-63ox2GMpDBvFzbvVL2GE4QWgKC0nQ9Y47k4MNTjowJcBv5gfQRTEuVrf80dDsCWfZrEXkWuNWFy_DuB7HFVTnvbac0sI0wtzkc0jjXYJQRUs4XDDQcvA-Gm_wcN_TmCrABA32fLrk-h0w-tFm5VY7qceKkPONk2xvpa6cZZbHStRVVTJhL8iKRYpAANw39Zt-Fvu0NVhzgoU04RNEV9nt5OYvY82sX4ZaWzgjddQOv-JlTkyqcbQlGKwdXZ6fboUHssTphdgXo-p6iUHsDzlcLSN2hZDe0UsqfdK9EzlsQ5eXcYalclPWeMi25SBaNA5BSeuPyLwcvASC3N_h8y5naN_qFlqRlrsBe_EDPSpmOCkWBbLP7fqcZySZ9Fn9PVJrGPwEOG0j_4REaP-_SycF3pDTV2XcPZNWyKqaHuxDCZ8NCul18vlTRLuWCgQqaP93arUEdXGM4GId_kPM7QX-NH8wVvEMeObYw3gxEJplps6BIMWr7m2eKSWyROI55zDg-6NULtUW3DpJCVsOmXW7MFwC7ovYRDMaW5mWHW0ZKtiwKnjZtLWY2gfiM6shBYDncCUbBGuHhPH-UOfH3lnR5YrC6PylNH7RHSfptdFOpVUggWD7Nup1TOo51tj1ZxYmpFDgAqgxHcHs8_s4s9uPd5YfOfietOrUnS2UmHIBVL9x-d7Eocez0HrvrzUlFHbsqDx5VDB9_OZyKUu6NleHDOZChnIKhzaGFyZF9pZM4DMYNvonBkAA.LtelNz0jIcBybdTYYE1jvIdqtFMJn_RaUQhtosrRqSY' is voorkomen vanwege een onbekend protocol.
(the captcha is a bit changed before posting.)

So I guess I should enter
signalcaptcha://signal-hcaptcha.30b01b46-d8c9-4c30-bbd7-9719acfe0c10.registration.P1_eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.hKdwYXNza2V5xQPQoCt_Ev66wdrP0DlpNEp54VnOWigpXaUDgFlK2SsuDEeIYD4aoBh8ySQKiKV_0Mvfb6WzhvgOJNZf3FNFvfP0UhpO0yeDtvTtwXO4bNwdZpXVRCpY91MtAH06VV0xuu1zI441tVjeoFO4m4s5j-v_weOAFv3xNxy_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s4s9uPd5YfOfietOrUnS2UmHIBVL9x-d7Eocez0HrvrzUlFHbsqDx5VDB9_OZyKUu6NleHDOZChnIKhzaGFyZF9pZM4DMYNvonBkAA.LtelNz0jIcBybdTYYE1jvIdqtFMJn_RaUQhtosrRqSY
in the captcha field.

I then always get the message
ZitatIncorrect captcha - e.g. needs to start with signalcaptcha://
This looks a bit as if there is still a compatibility issue.

Do I make a mistake?

mfg
{HT}
FHEM 6.2 auf Raspberry Pi3  (1,2 Ghz)
RFXTRX433XL, ZWave, KFL200 and ConBeeIII
Raspberry Pi1 (0,7 Ghz) and Raspberry Pi4 for testing
German reading skills are good.

Adimarantis

After trying for a while to get my Raspi400 working again after the 64bit upgrade, I decided to force it to 32bit again, setting
arm_64bit=0in /boot/config.txt

Probably that mix between 64Bit Kernel and 32Bit binaries causes a lot of issues.

I continued to have issues with the sqlite not finding the appropriate native library.
Even tried compiling a new native libsignal-client library, but that did not work either as this mixed up system still created 32bit libs.

The whole business with 32 vs 64 bit might also be the issue you're facing with moving your configuration.
Probably the account.db file in /var/lib/signal-cli has a binary dependency. Not sure if there is a tool to convert it.

For your registration problem: Do you have more data (e.g. from the FHEM logfile or lasterr reading)?
I hope this does not get messed up as well with this strange mix of 32 and 64 bit.

In a nutshell: I really recommend switching back to 32bit kernels as described above. Then your backup config should also work again.
Raspberry 4 + HM-MOD-RPI-PCB (pivCCU) + RfxTrx433XL + 2xRaspberry 1
Module: 50_Signalbot, 52_I2C_ADS1x1x , 58_RPI_1Wire, (50_SPI_MAX31865)

HarryT

Hi

Unfortunately the new script seems to have a problem.
When I use 
- signal_install backup
- signal_install restore
I get an error

Zitat● signal.service - Send secure messages to Signal clients
    Loaded: loaded (/etc/systemd/system/signal.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Sat 2023-04-01 20:39:26 CEST; 15s ago
    Process: 7186 ExecStart=/opt/signal/bin/signal-cli --config /var/lib/signal-cli daemon --system (code=exited, status=2)
  Main PID: 7186 (code=exited, status=2)
        CPU: 4.593s

apr 01 20:39:25 Rasp18-11 signal-cli[7186]: Caused by: java.lang.Exception: No native library found for os.name=Linux, os.arch=aarch64,
 paths=[/org/sqlite/native/Linux/aarch64:/usr/java/packages/lib:/usr/lib/arm-linux-gnueabihf/jni:
  /lib/arm-linux-gnueabihf:/usr/lib/arm-linux-gnueabihf:/usr/lib/jni:/lib:/usr/lib]
apr 01 20:39:25 Rasp18-11 signal-cli[7186]:        at org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:375)
apr 01 20:39:25 Rasp18-11 signal-cli[7186]:        at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:68)
apr 01 20:39:25 Rasp18-11 signal-cli[7186]:        at org.sqlite.core.NativeDB.load(NativeDB.java:63)
apr 01 20:39:25 Rasp18-11 signal-cli[7186]:        at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:278)
apr 01 20:39:25 Rasp18-11 signal-cli[7186]:        ... 47 more
apr 01 20:39:26 Rasp18-11 systemd[1]: signal.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
apr 01 20:39:26 Rasp18-11 systemd[1]: signal.service: Failed with result 'exit-code'.
apr 01 20:39:26 Rasp18-11 systemd[1]: Failed to start Send secure messages to Signal clients.
apr 01 20:39:26 Rasp18-11 systemd[1]: signal.service: Consumed 4.593s CPU time.

So for my understanding it seems to be necessary to have an aarch64  32 bit library.

See also https://en.wikipedia.org/wiki/AArch64

I am installing/testing on a Raspberrypi 4 with a 1,8 Ghz processor.

I hope this can be solved.

mfg
{HT}
FHEM 6.2 auf Raspberry Pi3  (1,2 Ghz)
RFXTRX433XL, ZWave, KFL200 and ConBeeIII
Raspberry Pi1 (0,7 Ghz) and Raspberry Pi4 for testing
German reading skills are good.

HarryT

Hi Adimarantis

Thanks for your work. Is there a specific place in config.txt to place the line arm_64bit=0 ?

I understand more and more what might be the problem of the instability of my production raspberry :)

The backup I had of signal-cli settings was corrupt so that was the reason why the accounts where not registered I guess. With a correct backup I see the problems of the aarch64 library. Having the corrupt part of the accounts in my installation may be the issue why I could not register.

I wonder if it is the time to switch to the 64 bit version of Raspbian. Anybody running FHEM etc on 64 bit?
 

 
FHEM 6.2 auf Raspberry Pi3  (1,2 Ghz)
RFXTRX433XL, ZWave, KFL200 and ConBeeIII
Raspberry Pi1 (0,7 Ghz) and Raspberry Pi4 for testing
German reading skills are good.

Adimarantis

I just put it at the very end of the config.txt

There are people that do run 64 bit already. That's why this experimental aarch64 support was included.
The required library was provided by the person running that kind of system. I don't have one on my own.
I'm currently in the process of compiling the updated libs for signal-cli 0.11.7 and will publish the updated installer shortly.

That however won't work with 64bit as I don't know how to compile the library.
Raspberry 4 + HM-MOD-RPI-PCB (pivCCU) + RfxTrx433XL + 2xRaspberry 1
Module: 50_Signalbot, 52_I2C_ADS1x1x , 58_RPI_1Wire, (50_SPI_MAX31865)

HarryT

Zitat von: Adimarantis am 01 April 2023, 21:30:51I just put it at the very end of the config.txt

There are people that do run 64 bit already. That's why this experimental aarch64 support was included.
The required library was provided by the person running that kind of system. I don't have one on my own.
I'm currently in the process of compiling the updated libs for signal-cli 0.11.7 and will publish the updated installer shortly.

That however won't work with 64bit as I don't know how to compile the library.

arm_64bit=0 seems to solve my problems. My accounts are recognized and I can send a message. The update of signal_install.sh seems not to be necessary.

Unfortunately I won't be the last with this problem.

If I can help with testing I am willing to do so

Thanks for all your work and help

I guess I will try a 64 bit installation in the coming days.

mfg
{HT}




FHEM 6.2 auf Raspberry Pi3  (1,2 Ghz)
RFXTRX433XL, ZWave, KFL200 and ConBeeIII
Raspberry Pi1 (0,7 Ghz) and Raspberry Pi4 for testing
German reading skills are good.

Adimarantis

So jetzt wieder zurück auf Deutsch.

Habe den Hinweis für die Umstellung zurück auf 32 Bit für Bullseye Raspberrys im Wiki dokumentiert.

Der Installer (wird mit "set reinit" neu geladen) wurde aktualisiert um signal-cli 0.11.7 mit der entsprechenden Native Library zu installieren. Für "echte" 64-Bit Raspberries wird weiter nur 0.11.2 unterstützt.
Ein update ist aber nicht zwingend erforderlich - es gibt aktuell keine mir bekannten neuen Funktion oder Fixes die für die FHEM Nutzung relevant sein sollten.
Raspberry 4 + HM-MOD-RPI-PCB (pivCCU) + RfxTrx433XL + 2xRaspberry 1
Module: 50_Signalbot, 52_I2C_ADS1x1x , 58_RPI_1Wire, (50_SPI_MAX31865)

tamash

Vielen Dank.
Durch diese Änderungen funktioniert signal wieder.

buec65

Ist das ein generelles Problem bei 64Bit?
Ich nutze

Linux Debian 4.19.269-1 (2022-12-20) x86_64

lsb_release -d
Description:  Debian GNU/Linux 10 (buster)

Registrierung einer Nummer schlägt mit dem Captcha fehl.
Der Link mit einer auf dem Handy genutzten Nummer funktioniert.

Muss ich da die Version 0.11.2 nutzen?

Adimarantis

Unter X86 war das schon immer 64 Bit.
Das ist ein Problem mit der halbherzigen 64 Bit Migration bei den Raspberries.
Inzwischen habe ich mir auch eine SD Karte mit dem offiziellen 64 Bit Raspian installiert und da funktioniert alles wieder wie es soll.

Ob es ein generelles Problem mit der Registrierung gibt, habe ich aktuell nicht getestet (das macht man ja nicht ständig).
In Zweifelsfall würde ich auf jeden Fall mal ein Update von signal-cli fahren (einfach den Installer mit "set reinit" aktualisieren und erneut durchlaufen lassen - sollte dann 0.11.7 installieren). Manchmal ändert sich was an der API und ältere Versionen haben Probleme.
Raspberry 4 + HM-MOD-RPI-PCB (pivCCU) + RfxTrx433XL + 2xRaspberry 1
Module: 50_Signalbot, 52_I2C_ADS1x1x , 58_RPI_1Wire, (50_SPI_MAX31865)

HarryT

Hmmm back again :-)

I tried a raspberry 64 bit installation and it seems to work but if I don´t receive messages.
When I run  a test I get:
sudo  /opt/fhem/www/signal/signal_install.sh test
You chose the following option: test

Start signal-cli service
Checking installation via dbus-send command...unexpected reply
method return time=1680446771.026133 sender=:1.62 -> destination=:1.63 serial=5 reply_serial=2 string "0.11.2"
Sending a message via perl Protocol::DBus...reply received

Any idea what could be wrong?

mfg
{HT}
FHEM 6.2 auf Raspberry Pi3  (1,2 Ghz)
RFXTRX433XL, ZWave, KFL200 and ConBeeIII
Raspberry Pi1 (0,7 Ghz) and Raspberry Pi4 for testing
German reading skills are good.

Adimarantis

Just tried the whole thing:
- Plain Raspian 64 lite installation on my Raspberry 400
- Installed fhem6.2.deb
- Created Signalbot device
- Used most current signal_install.sh to Install signal-cli 0.11.7
- Signalbot reinit -> Signalbot correctly showed signal-cli version, no account

Tried to copy /var/lib/signal-cli from my previous installation, however it somehow did not work, but I guess I used a too old backup that did not convert the config to 0.11.7 (there was no accounts.json which seems to be new in 0.11.7)
So I just started to register a number again, which worked as expected.

Could not send messages from the new Instance. (got an error that the recipient is not registered, though it was), however I could send messages TO the new instance and when I used the reply feature I could answer. I guess this is due to missing trust, that was created by re-registering. Once I sent a message from another device to the newly registered signal-cli instance and confirmed that it's ok that the device was changed, it started to work again in both directions.

In a nutshell: Only problems were the (expected) security issues with trust - apart from that all is working fine.


Raspberry 4 + HM-MOD-RPI-PCB (pivCCU) + RfxTrx433XL + 2xRaspberry 1
Module: 50_Signalbot, 52_I2C_ADS1x1x , 58_RPI_1Wire, (50_SPI_MAX31865)

HarryT

Hi

After the upgrade from 0.11.2 to 0.11.7 it works now on raspberry pi 64 bit.
For me a backup from 0.11.3 and a restore to my new installation worked.

Thanks for your work

mfg
{HT}


FHEM 6.2 auf Raspberry Pi3  (1,2 Ghz)
RFXTRX433XL, ZWave, KFL200 and ConBeeIII
Raspberry Pi1 (0,7 Ghz) and Raspberry Pi4 for testing
German reading skills are good.

Aeroschmelz

Hallo,

mich hat auch das letzte Update von Bullseye auf meinem Raspberry erwischt, so dass die Fehlermeldugn erschienen ist.  Ich habe dann auch am Ende der /boot/config.txt die Zeile arm_64bit=0 eingefügt, so dass zumindest die Fehlermeldung beim Starten des Dienstes weg ist ;-)
root@fhem:~# systemctl status signal
● signal.service - Send secure messages to Signal clients
     Loaded: loaded (/etc/systemd/system/signal.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2023-04-12 07:47:24 CEST; 6min ago
    Process: 614 ExecStartPre=/bin/sleep 10 (code=exited, status=0/SUCCESS)
   Main PID: 988 (java)
      Tasks: 37 (limit: 4915)
        CPU: 12.182s
     CGroup: /system.slice/signal.service
             └─988 /usr/lib/jvm/java-17-openjdk-armhf/bin/java -Xms2m -classpath /opt/signal/lib/signal-cli-0.11.4.jar:/opt/signal/lib/lib.j>

Apr 12 07:46:59 fhem systemd[1]: Starting Send secure messages to Signal clients...
Apr 12 07:47:19 fhem signal-cli[988]: WARN  MultiAccountManager - Ignoring +4961172389578: User is not registered. (NotRegisteredException)
Apr 12 07:47:23 fhem signal-cli[988]: INFO  DaemonCommand - Starting daemon in multi-account mode
Apr 12 07:47:23 fhem signal-cli[988]: INFO  TransportBuilder - Using transport dbus-java-transport-native-unixsocket to connect to unix:path>
Apr 12 07:47:24 fhem systemd[1]: Started Send secure messages to Signal clients.
Apr 12 07:47:24 fhem signal-cli[988]: INFO  DaemonCommand - DBus daemon running on SYSTEM bus: org.asamk.Signal
lines 1-16/16 (END)

Leider werden aber keine Nachrichten mehr verschickt. Bei Verbose 5 kommt folgendes:
[pre]2023.04.12 07:51:50 3: Signalbot: Before parse:@Marcus Test:
2023.04.12 07:51:50 4: Signalbot: sendMessage called for Marcus::Test
2023.04.12 07:51:50 5: Signalbot: Dbus Call sync:0 sendMessage(sasas) /org/asamk/Signal/_49XXX Args:Test,ARRAY(0x3e1a700),ARRAY(0x3e1a7a8)
2023.04.12 07:51:50 5: Signalbot: DBus callback: sendMessage Args:168127871005[/pre]

Das Device sieht folgendermaßen aus:
define Signalbot Signalbot
attr Signalbot DbLogExclude .*
attr Signalbot defaultPeer #Family
attr Signalbot event-on-change-reading .*
attr Signalbot group Netzwerk
attr Signalbot registerMethod Voice
attr Signalbot room Kommunikation
attr Signalbot showtime 1
attr Signalbot verbose 5
#  FD        20
#  FUUID      63c6ed5e-f33f-0756-da09-4c3476463cab5039
#  NAME      Signalbot
#  NOTIFYDEV  global
#  NR        57
#  NTFY_ORDER 50-Signalbot
#  STATE      Connected to /org/asamk/Signal/_49XXX
#  TYPE      Signalbot
#  VERSION    Signalbot:3.12 signal-cli:0.11.4 Protocol::DBus:0.22
#  model      Raspbian GNU/Linux 11 (bullseye)
#  .attraggr:
#  .attreocr:
#    .*
#  .attrminint:
#  READINGS:
#    2023-04-12 07:47:56  account        +49XXX
#    2023-04-12 07:47:56  accountName    Home
#    2023-04-12 07:44:11  joinedGroups    Family
#    2023-04-12 07:47:56  lastError      ok
#    2023-04-12 07:51:50  sentMsg        Test
#    2023-04-12 07:51:50  sentMsgTimestamp pending
#    2023-04-12 07:47:56  state          Connected to /org/asamk/Signal/_XXX
#  helper:
#    accounts  1
#    init      1
#    multi      1
#    signalpath /org/asamk/Signal/_XXX
#    version    1104
#    accountlist:
#      +4961172389577
#    attachments:
#    contacts:
#      +49XXX Marcus
#      +49XXX XXX
#      +49XXX XXX
#      +49XXX Home
#
setstate Signalbot Connected to /org/asamk/Signal/_XXX
setstate Signalbot 2023-04-12 07:47:56 account +XXX
setstate Signalbot 2023-04-12 07:47:56 accountName Home
setstate Signalbot 2023-04-12 07:44:11 joinedGroups Family
setstate Signalbot 2023-04-12 07:47:56 lastError ok
setstate Signalbot 2023-04-12 07:51:50 sentMsg Test
setstate Signalbot 2023-04-12 07:51:50 sentMsgTimestamp pending
setstate Signalbot 2023-04-12 07:47:56 state Connected to /org/asamk/Signal/_49XXX


Was ist denn besser? Updaten und/oder Nummer neu registrieren? 

Funktioniert das Problemlos, wenn man eine bestehende Nummer registriert?
Bei Neuinstallation vorher mit remove alles entfernen oder kann man einfach mit install drüber installieren ?