HI, i have (for now) two android tab to control my apartment. I want to control them via openhab. I want to turn on or of the screen from a rule. Or may be start and stop day dream !
So i could do thing like if nobody home turn off the screen. if everybody sleeping start daydream etc…
From memory:
I got openhab to send to the device a push via pushbullet.
Tasker would respond to the specific text in pushbullet and carry out the action.
I had Tasker run daydream at specific times.
I also had Tasker dismiss the message from pushbullet to keep it all clean.
Josh
I’m doing something similar with an AndroidTV (Nvidia Shield). It’s a bit of a “hack” solution, but it may work for you. (credit to the Nvidia Shield forums for suggesting this).
I’m using adb over the network to send Android keyevents to the device. Here’s what got me working on my OH1 server (running on Ubuntu):
Install android-tools-adb package
$sudo apt-get install android-tools-adb
Enable “Developer Mode” on the device, enable “USB Debugging” and “Network Debugging” Connect your device to the OH server USB port (may need to change to the ‘openhab’ user to make this work)
$adb devices
$adb connect 10.1.1.100 (or whatever your tablet's IP is)
You should see a warning on your device asking if you trust the OH server. Accept and never ask again. This is a one-time step. You should be able to do everything else over the network without prompting.
For OH1 integration, you’ll want to create bash script that connects to the device over the network and issues keyevents (like SLEEP and KEYCODE_POWER). Here is the script that I use for going to sleep and waking-up
EDIT: Just found out about a feature(?) that files in “/etc/openhab/configurations/scripts” get their permissions changed when OH restarts, and it removes the execute perms. Suggest putting it someplace else so you don’t have to change permissions each time it’s restarted. Updated the example above.
There are a whole lot of other KeyEvents that can be sent to it, but I wouldn’t suggest trying to use it for any real remote-controlling. It’s pretty slow. The sleep 1 is in there to add more reliability (was only working 75% of the time without it).
I’m using Tasker with the “Tasker Network Event Server” on the Android tablet and using openhab httpget commands in my rules to do things on the Android like wake screen and text to speech.
it’s really nice to all of you to give me idea like that !
Now i wana now ! What do you do with your tab ?
Alway open ? (it’s a good way to reduce the life of the tab and it make a lot of light at night)
Daydream ? ( it also make a lot of light and you need to tap on the screen each time you want to use it)
Motion sensor ? (does it work with low light ? )
Rule ? (how do you manage it ?? )
Daydream during the day, screen off at night.
Linked to my phone:
Night time was after on charge and screen off for 15 min.
Day time was screen on after 2am.
Josh
I wish this had been around when I started figuring this out for my tablets stuck to the wall. Might as well share my scripts in case they’re useful for someone. I’ve also set up a contact item to monitor screen state.