Is this the perfect standalone tablet for HA?

I thought there was a long post with detailed instructions on how to install for either Windows, Linux, or Mac but now I can’t find it. The instructions in the original post assume a level of knowledge that I don’t have since I’m a newbie with Linux.

I did some more testing on the display on/off front, maybe someone can read something out of it (I’m not a developer, certainly not an Android developer)

Short version:
Quite a few commands/parameters that I’ve found should turn on/off the screen, or indicate the state don’t to so.
However, the adb shell input keyevent 26 command worked in my tests, to send the screen to sleep.
The mScreenBrightness and mScreenBrightnessModeSetting parameters seem to properly indicate, if the screen is on or off.
I could not find a reliable way yet, to wake the display, nor do I know (yet?) how to make use of these findings to turn off the display without accessing the device over adb.
I’ve actually uninstalled the Home Assistant app in the meantime, so this is not the root cause for the screen not going to sleep. The issue also persists when using WallPanel.

Long version:
There is an adb command to press the “virtual” power button (actually, there are even more than one). It seems that the adb shell input keyevent 26 command on this device does actually only work for turning off the display, it won’t wake the device.

Logcat presents the following output after sending that event:

01-20 15:27:52.336 11186 11186 D AndroidRuntime: Calling main entry com.android.commands.input.Input
01-20 15:27:52.340 11186 11186 I Input   : injectKeyEvent: KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_POWER, scanCode=0, metaState=0, flags=0x0, repeatCount=0, eventTime=64181066, downTime=64181066, deviceId=-1, source=0x101 }
01-20 15:27:52.342  1206  1352 I PowerManagerService: Going to sleep due to screen timeout (uid 1000)...
01-20 15:27:52.345  1206  1352 D AppOps  : startOperation: allowing code 40 uid 1000 package android
01-20 15:27:52.357 11186 11186 I Input   : injectKeyEvent: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_POWER, scanCode=0, metaState=0, flags=0x0, repeatCount=0, eventTime=64181066, downTime=64181066, deviceId=-1, source=0x101 }
01-20 15:27:52.357  1206  1352 I PowerManagerService: Going to sleep due to power button (uid 1000)...
01-20 15:27:52.360  1206  1352 I PowerManagerService: Going to sleep due to screen timeout (uid 1000)...
01-20 15:27:52.363 11186 11186 D AndroidRuntime: Shutting down VM
01-20 15:28:00.001  1206  1269 I PowerManagerService: Going to sleep due to screen timeout (uid 1000)...
01-20 15:28:00.005  1360  1360 D KeyguardUpdateMonitor: received broadcast android.intent.action.TIME_TICK
01-20 15:28:00.006  1360  1360 D KeyguardUpdateMonitor: handleTimeUpdate
01-20 15:28:00.019  1206  1206 I PowerManagerService: Going to sleep due to screen timeout (uid 1000)...
01-20 15:28:43.065  1360  1360 D KeyguardUpdateMonitor: received broadcast android.intent.action.BATTERY_CHANGED
01-20 15:28:43.065  1322  1808 D HeadsetStateMachine: Disconnected process message: 10, size: 0
01-20 15:28:43.065  1322  1808 D HeadsetStateMachine: Enter processIntentBatteryChanged()
01-20 15:28:43.065  1322  1808 D HeadsetStateMachine: Exit processIntentBatteryChanged()
01-20 15:28:43.065  1322  1808 D HeadsetStateMachine: Exit Disconnected processMessage() 
01-20 15:28:43.067  1577  1577 D QtiCarrierConfigHelper: WARNING, no carrier configs on phone Id: 0
01-20 15:28:43.069  1360  1360 D KeyguardUpdateMonitor: handleBatteryUpdate
01-20 15:28:53.727  1206  1216 I zygote  : Background concurrent copying GC freed 116463(18MB) AllocSpace objects, 18(808KB) LOS objects, 58% free, 12MB/30MB, paused 193us total 150.355ms
01-20 15:29:00.001  1206  1269 I PowerManagerService: Going to sleep due to screen timeout (uid 1000)...

If this command is sent, the screen actually dims more or less immediately, and after the screen timeout setting (at least it appears so), it goes dark completely.

When comparing certain parameters, that should indicate if the screen is currently on or off, I’ve found that most of the values don’t really help. I actually tried the following commands to compare the parameters:

  • adb shell dumpsys display | grep "mScreen"
  • adb shell dumpsys power
  • adb shell dumpsys power | grep mPowerState (no value returned)
  • adb shell dumpsys input_method | grep mInteractive=true

the following return values differed between on and off:

  • mScreenBrightness (on: 255, off: 10)
  • mScreenBrightnessModeSetting (on: 1, off: 0)
  • the Looper state returned 3 messages when the screen was on (including the AutomaticBrightnessHandler when the screen was on), vs. only 1 message when the screen was off
2 Likes

Really appreciate all the effort going into this, we’re seeing some great contributions!

Does this work to change brightness?

adb shell settings put system screen_brightness X

Where X is 1-255

Could we use the following command to ease some of the audio focus problems?

adb shell appops set package.name TAKE_AUDIO_FOCUS ignore

Also, check out PermissionManagerX

Check out @Nerwyn’s post, I finally got around to linking it up top.

1 Like

Ok, here come the newbie questions…

When I enter UsbDkController -n in Power Shell or in Python, here is what I get:

Both Git and Python 3.9 are installed.

Also, on the EDL install page, when is the process done? That isn’t clear.

I really don’t want to step into @mattmon’s sandbox because his instructions are complete. But, requiring a bit more than a passing exposure to Linux and I think I may have insulted him by calling it a spaghetti bowl of instructions. (I apologize). My issue was that the instructions for Windows, Linux and Mac were all in the same bowl.

I made notes to myself when I used a Ubuntu computer to install the firmware on my ThinkSmart. You can see them here. (This is the first time I shared anything from my notebook. Please let me know if you can see it.)

1 Like

It’s our sandbox, that’s the point of a community, right?

I recently referenced spaghetti in another thread. Pasta is sometimes a fair technical assessment.

Really, my primary concern with the instructions in OP is to keep them simple and versatile.

I’d rather have someone dive in and ask a lot of questions than scare them away with complexity.

Not to say that granularity can’t be helpful.

@stevemann: if you post the guide you PM’d me, I’ll be happy to link it above.

3 Likes

Just curious, but it doesn’t look like the horizontal boot animation is included. Is there anyplace we could grab that file from?

It is in my wiki.
You can see them here

I PM’d it to you for your critique because there has to be at least one error in my process. (Track record). If it looks good, then feel free to post the link to my Wiki page.

2 Likes

That’s exactly what I needed. Thank you. However, I got this error when trying to run “pip3 install -r requirements.txt”:

Out of curiosity, I kept going and when I tried to start EDL using “./edl qfil ~/edl/bin/rawprogram.xml ~/edl/bin/patch0.xml ~/edl/flash --loader=~/edl/bin/prog_emmc_firehose_8953_ddr.mbn” I got this:

Ok, i added the ‘pip install -r requirements.txt --break-system-packages’ that error message suggests and it installed. Then, I went thru all of the steps again.
However, it is still looking for module named “docopt” when I try to run ’ ./edl qfil ~/edl/bin/rawprogram.xml ~/edl/bin/patch0.xml ~/edl/flash --loader=~/edl/bin/prog_emmc_firehose_8953_ddr.mbn’

Both are already present within the rom. See extras section in OP

I’m a knucklehead. The file is there, but it’s not named .horiz, it’s named .horizontal. Please double check me, but I think post 1 extras and notes last command needs to be updated.

2 Likes

Have you added the UsbDk installation folder to your system path? For me it’s C:\Program Files\UsbDk Runtime Library.

I’ve seen so many great dashboards, it seems kind of unfair to everyone that I haven’t posted mine.

Though for good reason, I haven’t put nearly as much time or thought into mine as others and it shows!

Never the less, here goes, please take it easy on me :wink:

It’s just the wallpanel app, pointing to a specific dashboard with HA wallpanel mode enabled and some pretty egregious abuse of bubble card’s CSS.

I would really like to get some kind of voice assistant stack running, and will be working toward that in the future.

If you build edl outside a venv, you’ll likely end up with a broken mishmash of system deps and stuff pip installed.

Make a venv specifically for edl as the warning dialog suggests. Then make sure to reference that venv for each subsequent python related command.

1 Like

Mine may take the prize for plain and simple. It is on the side of my desk and only shows my driveway and front porch cameras. I’ll take a photo if I ever get my desktop cleaned up.

No, doesn’t work.

But I got a little further. Sending the wake command over mqtt (Wallpanel app) does turn on the screen immediately.
it works as indicated in the WallPanel documentation:

json payloads sent to the mqtt topic: wallpanel/mywallpanel/command

  • wake: {"wake": true}
    it also seems to “reset” the issue with the screen not timing out, since the screen goes back to sleep after the timeout when sending that command.
This returned the following logs in logcat:
01-21 10:10:36.142  1206 13999 D AppOps  : noteOperation: allowing code 23 uid 10069 package xyz.wallpanel.app
01-21 10:10:36.146  1206 13999 D AppOps  : noteOperation: allowing code 23 uid 10069 package xyz.wallpanel.app
01-21 10:10:36.312   672   705 E libnav  : CablComputeBacklightLevel(): UpdateType = DifferentSceneUpdate
01-21 10:10:36.328   672   705 E libnav  : CablComputeBacklightLevel(): UpdateType = DifferentSceneUpdate
  • screen off: {"wake": false}
    doesn not work and does not produce any log entries in logcat either.
    however, the adb shell input keyevent 26 still works to turn off the screen, even when it’s stuck on

I tried testing a few other mqtt commands, but they did have no effect (again: not even logcat entries).
the {"settings": true} command does work, and open the WallPanel settings, however, if the screen times out / or was already timed out before, apparently it blocks further mqtt commands from being executed.
From that state (being in the settings menu) I tried to go back to the Home Assistant dashboard using the {"url":<http://....>} command, but that one didn’t work either. So best to avoid opening the settings over mqtt.

The {"url":<http://....>} does work (when not being stuck in the settings), so it can be used to load a specific dashboard - even if that takes 2-3 seconds to complete.

Sadly, the screenOn Parameter in the wallpanel/mywallpanel/state topic doesn’t work, and does not correctly report the screen state (neither does the brightness level).
So at the moment, we can’t get the current screen state without actually polling them using adb commands.

However, it seems, we can at least turn on the screen in Home Assistant using the mqtt command, and turn if off again using an adb command (there is an ADB integration, I’m going to test that next)

1 Like

The ADB integration in Home Assistant seems to work fine for turning off the screen, not so much for turning it off though - but at the moment I feel like this is the more important issue anyway.

When using the WallPanel app, you can actually even use the media player entity, to turn off the screen. Example action:

service: media_player.turn_off
metadata: {}
data: {}
target:
  device_id: <home_assistant_id_for_thinksmart_view>

If not, an ADB action works perfectly fine too:

service: androidtv.adb_command
metadata: {}
data:
  command: input keyevent 26
target:
  device_id: <home_assistant_id_for_thinksmart_view>

The media_player.turn_on action doesn’t work to turn on the screen - as expected

In order to wake up the device, the following action can be used (using the MQTT integration and WallPanel’s mqtt capabilities:

service: mqtt.publish
metadata: {}
data:
  qos: "1"
  payload: "{\"wake\": true}"
  topic: wallpanel/mywallpanel/command

So with these actions, we can at least automate turning on and off the tablet, depending on some Home Assistant triggers (e.g. entering/leaving the area, detected movement, lights turning on/off, etc…)

For the ADB command to work, ADB debugging over network/tcp needs to be enabled. In order to do that, you need to connect to the device using ADB over USB port once and enable ADB over network as indicated above:

The only issue is, that after a reboot of the device, ADB is not acessible over network any more. However, luckily there’s a work-around for that as well, though it involves actually interacting with the tablet:

Maybe there is a way to actually properly persist the ADB over network setting?

1 Like

Getting this error even though i replaced the libsub drive as suggested. Did you see this/know a fix?

 ...Traceback (most recent call last):
  File "C:\Users\scott\edl\edl", line 386, in <module>
    base.run()
  File "C:\Users\scott\edl\edl", line 289, in run
    conninfo = self.doconnect(loop)
  File "C:\Users\scott\edl\edl", line 199, in doconnect
    self.cdc.connected = self.cdc.connect(portname=self.portname)
  File "C:\Users\scott\edl\edlclient\Library\Connection\usblib.py", line 240, in connect
    self.configuration = self.device.get_active_configuration()
  File "C:\Users\scott\AppData\Local\Programs\Python\Python39\lib\site-packages\usb\core.py", line 921, in get_active_configuration
    return self._ctx.get_active_configuration(self)
  File "C:\Users\scott\AppData\Local\Programs\Python\Python39\lib\site-packages\usb\core.py", line 113, in wrapper
    return f(self, *args, **kwargs)
  File "C:\Users\scott\AppData\Local\Programs\Python\Python39\lib\site-packages\usb\core.py", line 249, in get_active_configuration
    self.managed_open()
  File "C:\Users\scott\AppData\Local\Programs\Python\Python39\lib\site-packages\usb\core.py", line 113, in wrapper
    return f(self, *args, **kwargs)
  File "C:\Users\scott\AppData\Local\Programs\Python\Python39\lib\site-packages\usb\core.py", line 131, in managed_open
    self.handle = self.backend.open_device(self.dev)
  File "C:\Users\scott\AppData\Local\Programs\Python\Python39\lib\site-packages\usb\backend\libusb1.py", line 804, in open_device
    return _DeviceHandle(dev)
  File "C:\Users\scott\AppData\Local\Programs\Python\Python39\lib\site-packages\usb\backend\libusb1.py", line 652, in __init__
    _check(_lib.libusb_open(self.devid, byref(self.handle)))
  File "C:\Users\scott\AppData\Local\Programs\Python\Python39\lib\site-packages\usb\backend\libusb1.py", line 600, in _check
    raise NotImplementedError(_strerror(ret))
NotImplementedError: Operation not supported or unimplemented on this platform

Could this be related?
Capture

UPDATE: I was able to find a PC that would run the live Linux usb suggested on the EDL git. That worked!

Yes, you must a modify default.prop inside the partition image(s).

“Image(s)” because default and vendor.prop are a hierarchy of files scattered throughout the file system.

Are you using Wallpanel? I believe it has a setting in there to keep the screen awake. By default, the HA companion app will not keep the display on.