[AndroidTV] Simple OSD Remote

Post Reply
User avatar
nayr
Posts: 430
Joined: Tuesday 11 November 2014 19:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

[AndroidTV] Simple OSD Remote

Post by nayr » Saturday 09 January 2016 23:00

My first app for Android or even Java, designed for the AndroidTV, its so stupid simple but it involves Domoticz so I'll share:

Source Code: https://github.com/nayrnet/androidtv-osd-remote
Image

A prebuilt package wont be much use to anyone its all hardcoded values, I ripped it off from: https://github.com/bsara/reboot-android-tv

I had this functionality when I ran a big media center pc, hacked the Plex Home Theatre theme to send commands to domoticz and change inputs from the main menu.. but when I moved to Android for better power consumption I lost this functionality, that is until last night.

I have a lil bit more stuff I want to add, mainly a popup window after changing input that says press OK to switch back.. so when I switch to a gaming console or turn TV off I can go back to the nexus player (and domo will turn tv back on if needed) later by just pressing the enter button on the nexus remote twice (once to wake it up and once to close dialog).. Now I just need a wireless volume nob of some sort and I can ditch the universal remote.

I dont plan on making it customizable or any of that stuff, already spent too much time on this really and I dont want anyone (toddlers) mucking about in a settings menu now that it works. I run the AndroidTV restricted profile with minimal apps to keep the kids out. I will clean it up and post it to github shortly so if you want to hack it and build your own version you can.. its pretty easy, the android devel kit is pretty slick.. Consider it a sample program you can quickly modify for your unique setup, adding/removing/modifying buttons and changing the feel is pretty easy, I figured it out in a few hours, and most of that was spent blindly not realizing that my emulation environment lacked network access, thus all calls to domo failed, sideloaded it on the nexus player and wam.. worked fine.

If demand is high enough I may be convinced to spend bit more time on it in the future.. but I'd really like someone to pick this up and run with it.

here is a sniplet of code to show how simple it is:

Code: Select all

  public void execAction(View selectedView) {
    switch (selectedView.getId()) {
      case R.id.main_actionItem_ipcameras:
        new AsyncHttpTask().execute("http://192.168.254.33:8080/json.htm?type=command&param=switchlight&idx=127&switchcmd=On");
        this.finish();
        break;
      case R.id.main_actionItem_ps3:
        new AsyncHttpTask().execute("http://192.168.254.33:8080/json.htm?type=command&param=switchlight&idx=101&switchcmd=On");
        this.finish();
        break;
      case R.id.main_actionItem_ps4:
        new AsyncHttpTask().execute("http://192.168.254.33:8080/json.htm?type=command&param=switchlight&idx=102&switchcmd=On");
        this.finish();
        break;
      case R.id.main_actionItem_poweroff:
        new AsyncHttpTask().execute("http://192.168.254.33:8080/json.htm?type=command&param=switchlight&idx=104&switchcmd=Off");
        this.finish();
        break;
      case R.id.main_actionItem_mute:
        new AsyncHttpTask().execute("http://192.168.254.33:8080/json.htm?type=command&param=switchlight&idx=105&switchcmd=Toggle");
        this.finish();
        break;
      case R.id.main_actionItem_dim:
        new AsyncHttpTask().execute("http://192.168.254.33:8080/json.htm?type=command&param=switchscene&idx=5&switchcmd=On");
        this.finish();
        break;
      case R.id.main_actionItem_lightsout:
        new AsyncHttpTask().execute("http://192.168.254.33:8080/json.htm?type=command&param=switchscene&idx=6&switchcmd=Off");
        this.finish();
        break;
      default:
        this.finish();
        break;
    }
Last edited by nayr on Friday 29 January 2016 10:53, edited 2 times in total.
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth

User avatar
nayr
Posts: 430
Joined: Tuesday 11 November 2014 19:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: [AndroidTV] Simple OSD Remote

Post by nayr » Monday 11 January 2016 1:22

everything is on github now, I made a 2nd version specific for my bedroom Nexus Player.. that TV dont have any other inputs hooked up but it does have ON/OFF for its self and buttons to toggle the bedroom lights, the hallway lights, turn my son's TV on/off, and mute the living room TV (when someone's sick in bed and needs help).

I was going to install a physical button next to the bed to turn on/off lights from bed, but this software button will do just fine.. and it was free!

Now to upgrade my son's roku with a nexus player, then I can build him an app to turn his lights on/off from bed.
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth

User avatar
galadril
Posts: 569
Joined: Monday 07 September 2015 10:32
Target OS: Raspberry Pi
Domoticz version: latest
Contact:

Re: [AndroidTV] Simple OSD Remote

Post by galadril » Friday 12 August 2016 11:42

PS Working on a Domoticz version for TV:
viewtopic.php?f=37&t=12955&p=93147
Solar panels of Ginlong, Omnik-Solar, Transenergy or Solarman?? Try my Android app:
https://play.google.com/store/apps/deta ... ongmonitor

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest