Nice work. Unfortunately I was not able to install selenium standalone docker on openHABian and I dont like JRuby. So I re-implemented the code using Node and used ChromeDriver directly.
How to use?
- Install Node.js,
- clone https://github.com/Plustig/Android-Phone-Finder/
- install app using ‘npm install’ in project’s root directory
- Install ChromeDriver using ‘sudo apt-get install chromium-chromedriver’
- copy path of chromedriver binary in constructor method of app.js
Support for multiple phones is missing. I invoked the node app like this
/*
This rule scrapes the google's 'find my phone' page to let the phone ring
*/
var Exec = Java.type("org.openhab.core.model.script.actions.Exec");
rules.JSRule({
name: "Ring My Phone",
description: "This rule scrapes the google 'find my phone' page to let the phone ring",
triggers: [triggers.ChannelEventTrigger("deconz:switch:homeserver:tdfr_shortcut_findphone:buttonevent", "1002")],
execute: data => {
console.log("Let your phone ring...");
Exec.executeCommandLine( 'node', '/home/openhabian/selenium-test-app/app.js', 'ring');
}
});
rules.JSRule({
name: "Refresh google cookies",
description: "This rule reloads the google cookies needed for authentification.",
triggers: [triggers.GenericCronTrigger("0 0 */3 ? * *")],
execute: data => {
console.log("Refresh google cookies...");
Exec.executeCommandLine( 'node', '/home/openhabian/selenium-test-app/app.js', 'refresh');
}
});