GithubHelp home page GithubHelp logo

mwarning / trigger Goto Github PK

View Code? Open in Web Editor NEW
126.0 15.0 22.0 4.47 MB

Android app to lock/unlock/ring doors. Supports generic HTTPS/SSH/Bluetooth/MQTT and Nuki Smartlock.

License: GNU General Public License v3.0

Kotlin 100.00%
android https remote-control door-controller ssh fdroid bluetooth mqtt nuki-smartlock

trigger's Introduction

Trigger

Trigger is an Android App to unlock/lock doors, show the door status and ring a bell.

Features:

  • Generic HTTPS, SSH, Bluetooth/BLE and MQTT support
  • support for Nuki SmartLock
  • multiple door profiles
  • auto select profiles by connected WiFi
  • HTTPS server/client certificate support
  • SSH key generation support (ED25519, RSA,...)
  • custom status images
  • QR code support
  • backup support

image

(more Screenshots)

Any help, bugfixes, new features, translations are much appreciated.

Download

Get it on F-Droid Get it on GitHub Get it on Google Play

The minimum supported Android version is 5.0.

Documentation

For further feature explanations and How-Tos, see the Documentation page.

Similar/Related Projects

License

This work is licenced under the GNU General Public License version 2 or later (GPLv2).

Icons: Googles Material Design

trigger's People

Contributors

bubu avatar clach04 avatar danchal avatar michiwend avatar mwarning avatar s3lph avatar zelch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

trigger's Issues

ssh fails to send commands

Using the latest F-Droid build (3.3.0) on Android 11 with an existing config that had worked just fine, and with a similar new config with a fresh key.

When connecting, the server accepts the key, and Trigger shows "Remote end closed connection".

The connection shows the "Unknown Status Image" regardless.

I added some crude debugging to the server end and it seems Trigger is not sending the commands. They are simply start,stop or status.

Test from laptop:
20210602_140440 : invoked with 'stop'
20210602_140440 : UNLOCKED
20210602_140445 : invoked with 'status'
20210602_140445 : UNLOCKED

Test from Trigger
20210602_140557 : invoked with ''
20210602_140557 : Invalid
20210602_140601 : invoked with ''
20210602_140601 : Invalid

in authorized_keys I have lines like:

no-port-forwarding,no-x11-forwarding,no-agent-forwarding,command="/home/pi/bin/controldoor" ssh-[keyver] [pubkeydata] [comment]

..which worked fine before, and work fine when called from laptop with e.g.
ssh -i testkey pi@$IP status

The server command (controldoor) looks like this:

#!/bin/bash
arg="$1"
[ -z "$1" ] && arg="$SSH_ORIGINAL_COMMAND"
debug="1"

[ ! -z "$debug" ] && {
    now=$(date +%Y%m%d_%H%M%S)
    logfile=/tmp/motionconlog
    echo "$now : invoked with '$arg'" >> "$logfile"
}

emit(){
    [ ! -z "$debug" ] && echo "$now : $1" >> "$logfile"
    echo "$1"
}

case $arg in
 start) doorlock start && e="LOCKED" || e="LOCKFAIL";;
 stop) doorlock stop && e="UNLOCKED" || e="UNLOCKFAIL" ;;
 status)
        doorlock status >/dev/null 2>&1 &&\
         e="LOCKED" ||\
         e="UNLOCKED"
 ;;
 *) e="Invalid arg" >&2 ;;
esac
emit $e

..crude, but it worked previously, and clearly is getting called when Trigger connects, but no command is sent.

WiFi reconnect detection

Testing your good work to fix the four status's at startup thing (which really speeds up startup.. nice!), I observed the following:-

It seems to be detecting WiFi changes, but not actually re-getting the status on reconnect. The behaviour is different with and without fixed SSID. The situation is only resolved by chanigng config, or quitting and re-opening.

Testing first on Lineage 18.1 official with MindTheGapps (android 11). This one has a SIM card.

Settings1:
WiFi required on. Fixed SSID set. Location permission granted so the app can see the SSID. Mobile data on as fallback.
Turning off WfFi instantly displays "SSID Mismatch (connected to ''"), and the "No connection" image.
Re-enabling WiFi, at the moment of reconnect displays "WiFi disabled".
Lock/Unlock buttons do not work.

Settings2:
Same, but fixed SSID empty.
Turning off WiFi instantly displays "The was a problem while connecting to $address::$port" and the "Unknown status" image.
Re-enabling WiFi, at the moment of reconnect displays "WiFi disabled", and it switches to the "No connection" image.
Lock/Unlock buttons do not work.
In this case, the "Unknown status" phase does not happen with mobile data off.

In both cases the app doesn't attempt to recheck the status on reconnect, but notably seems to incorrectly detect the moment of reconnect as "WiFi disabled".

On a LineageOS 14.1 (Android 7) with no mobile data capability, it behaves as above, as if it had mobile data (two states shown in Settings2).

I have only tested by turning wifi off and on again. If you want me to test by turning the A/P off and on, just ask and I'll go sit at a wired computer.

Ignore Errors documentation for Ignore HTTPS certificate errors

I'm experimenting with Trigger app from Android with a Python Flask script that can be deployed with https certs or over plain http.

  • It works fine over http
  • It only works over https if the ignore errors option is set

I'm using a self signed certificate and I install the cert onto my phone (successfully) but I have to enable ignore errors.

Do you have any documentation how this can be set to not ignore errors?

Sample ssh command

Any value in adding a sample ssh command? The docs are clear on what the output should look like, but a small example may be useful. Here is a longer than needed but hopefully easy to understand sample:

#!/bin/sh
# Lock demo, suitable for use with ssh mode of https://github.com/mwarning/trigger


COMMAND=$1

case ${COMMAND} in
    lock | close | shut)
        # issue lock command
        # assume it was successful and report locked
        echo LOCKED
        ;;

    open | unlock)
        # issue unlock command
        # assume it was successful and report locked
        echo UNLOCKED
        ;;

    status | *)
        # issue status command
        # assume it was successful and default/report locked
        echo LOCKED
        ;;

esac

# Trigger 1.7.1 will show correct image assuming the above is clean
# debug or additional information can then be displayed below
# it shows up in a Toast style message
# Date/time is a useful addition
#echo debug test
date

no connect via ssh

I'm trying to control an SR-201 IP Relay via ssh and python.
When trying to connect via ssh to the server, the toast
Session.connect: java.oi.IOException: End of IO Stream Read
appears.
Screenshot_20200609-123048

No login happens and the server log says:
sshd[171698]: ssh_dispatch_run_fatal: Connection from 192.168.0.52 port 49083: DH GEX group out of range [preauth]
while the port is incremented at each time. I've checked the public key and any other settings from the shell of a linux box - it works well there.
Using on XPeria X Compact with Android 8.0.0 (Sep 2018).

explicity delete imported certificate/key

This is not really a pressing issue. But it is easy to add if we can rid of the use of preference classes (and the two hacks attached to it) in favor of fragment layouts. Right now we would need an additional button....

"SSID Mismatch" debugging?

Could you add an "Expected" vs "Actual" output to the SSID Mismatch notification? I'm pretty sure I'm typing the SSID correctly but am getting a mismatch.

Samsung Galaxy S9+, Android 10, Sept 2020 security patch level. Maybe Samsung did something that breaks SSID lists?

ssh key registration hangs

we are using the ssh key registration feature (btw. it would be nice to get rid of the forced schema, so users only need to enter host:port and not nnn://host:port) and we have tested it with a broad range of phones - but on all of them we need to force a kill of the app to have the pubkey sent.

would be great if you could look into this!

compress qr code data

Key or certificates as part of the setup often do not fit into the QR-Code. Compress might help here.
Some data as pictures (in future versions) would need to be removed.

Status not read on state change

Sorry to do this to you so soon after closing one.
Hitting either lock or unlock in my ssh config as previously used, I see the "Unknown status" image. The other end is replying with the correct strings, in fact nothing has changed there since it was behaving right.
Hitting the same action again gets the correct status shown, as does hitting the background to force a refresh, or closing and reopening, whereupon 'status' is invoked.
Hitting lock from an unlocked state gets me 'unknown', hitting unlock from there also gets me 'unknown'.
Seems to be ignoring responses on 'do stuff' commands, but only the first time each way.

lintVitalRelease fails

The package cannot be build by f-droid (or anyone trying to build it via commandline gradle) because the lintVitalRelease task fails:

:app:lintVitalRelease/home/mhoffmann/projects/oss/fdroiddata/build/com.example.trigger/app/src/main/res/values/array.xml:3: Error: "SetupTypes" is not translated in "de" (German) [MissingTranslation]
    <string-array name="SetupTypes">
                  ~~~~~~~~~~~~~~~~~
/home/mhoffmann/projects/oss/fdroiddata/build/com.example.trigger/app/src/main/res/values/array.xml:8: Error: "SetupTypeValues" is not translated in "de" (German) [MissingTranslation]
    <string-array name="SetupTypeValues">
                  ~~~~~~~~~~~~~~~~~~~~~~

   Explanation for issues of type "MissingTranslation":
   If an application has more than one locale, then all the strings declared
   in one language should also be translated in all other languages.

   If the string should not be translated, you can add the attribute
   translatable="false" on the <string> element, or you can define all your
   non-translatable strings in a resource file called donottranslate.xml. Or,
   you can ignore the issue with a tools:ignore="MissingTranslation"
   attribute.

   By default this detector allows regions of a language to just provide a
   subset of the strings and fall back to the standard language strings. You
   can require all regions to provide a full translation by setting the
   environment variable ANDROID_LINT_COMPLETE_REGIONS.

   You can tell lint (and other tools) which language is the default language
   in your res/values/ folder by specifying tools:locale="languageCode" for
   the root <resources> element in your resource file. (The tools prefix
   refers to the namespace declaration http://schemas.android.com/tools.)

2 errors, 0 warnings
 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Lint found fatal errors while assembling a release target.
  
  To proceed, either fix the issues identified by lint, or modify your build script as follows:
  ...
  android {
      lintOptions {
          checkReleaseBuilds false
          // Or, if you prefer, you can continue to check for errors in release builds,
          // but continue the build even when errors are found:
          abortOnError false
      }
  }
  ...

ToDo List

  • Use Fragments instead of Preference UI classes
    • This would also remove some minor hacks.
  • translations
  • be able to trigger an https open command and a bluetooth door bell
  • parse door return data in various ways (e.g. json) (sort of - regex..)
  • translate to Kotlin
  • differentiate between locked/closed terminology

Allow image resizing on import

Currently, the status background image does not cover the whole width.
That is desirable to have. A method to resize an image on import is therefore a good idea.

A good start is to make show the images on full width already and add a padding to the default images.

Reply pattern is not available when MQTT is chosen

First of all thank you for the great app! Just one little problem I am having with v3.3.1 (obtained from F-droid if that matters)

The document mentions that the reply patterns should be available, but when I select generic MQTT those options disappear.

TIA!

Fix ssh feature

Currently, key import/export is broken because of permission issues.
Unless then, no testing can be done.
Other than that, the code might be working condition already.

ssh config causes at least 3.2.0 and 3.2.1 to FC on android 11

Simply creating an ssh config, e.g. door name test, IP 127.1.2.3, port 12322, seems to save ok, but the app will only run for a fraction of a second when you leave the config. It will not run again until the app data is erased.

I did have three ssh 'doors' working well in my old config, on Lineage 16. Not now I don't.

Tried on two different Lineage 18.1 installs.

Android 11 file selection fails

Most file handling appears b0rked in Android 11.

Exporting a config fails with:

Error
java.io.IOException: Operation not permitted

(Files permissions are granted)

Importing images shows no files in a folder with several jpegs that were importable in previous versions.

I expect importing config would fail too. I'll check with an export from an older droid later.

Thanks for this fantastic tool!

Generic https call protcol

Interesting Settings:

  • setting name
  • URL1 (full url + button text)
  • URL 2 (full url + button text)
  • URL 3 (full url + button text)

Nuki connect support

Hello there,

I installed the trigger app on my android phone and made the necessary settings for nuki, you can see below.

WhatsApp Image 2021-03-11 at 10 37 19

But after making these adjustments, I cannot connect to the device and send commands.

My Nuki device was tested in 2 cases

  • previously installed on its own app
  • and factory reset and tested

Trigger application failed to connect nuki in both cases. Is there something we did wrong?

Compatible lock

Hi,

At office we are interest to use your app for control the door lock and especially by Wifi (HTTPS request).
But we want know which system are compatible with the app.

Thank's in advance.

put app on google play store

I would like to put the app on the google play store (right now it is on fdroid only). But there I would like to charge a minimal fee to cover further development costs.

@michiwend since you provided the original source code, I need to ask you for permission if I charge some money for this app on the google play store. Is that ok with you?

SSH authentication with pubkey and password

Hello,
I have set up my sshd_config on the target system using the following commands:

PubkeyAuthentication yes
PasswordAuthentication yes
AuthenticationMethods publickey,password

As such both the publickey has to be an authorized key, as well as the password of the user account has to match. Unfortunately, this combination did not work for me in the app. When a password is set the pubkey is not used, and when the password field is left blank, the key is used but obviously the password is missing.
Expected behaviour with a key pair set and a password set would be to use both, rather than only one depending on the state of the password field.
version tried was 3.3.1

new name

sphincter is not very user friendly.
Other names:

  • doorman
  • fender
  • bouncer
  • mellon-projects / mellon-android / mellon-server

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.