Command line switch fail

Hi, all!

I have this switch, but it is staying only off, any idea?

- switch:
    name: ADB Home Tablet
    unique_id: adb_home_tablet
    command_state: "adb devices"
    value_template: "{{ '192.168.0.113' in value }}"
    command_on: "adb connect 192.168.0.113"
    command_off: "adb disconnect 192.168.0.113"

Thanks!

Edit: I added a shell_command as well, to see if is working and I get this error /bin/sh: adb: not found, why it is not working? In the terminal, all the adb commands are ok

Edit: i made the shell_command like this
adb_home_tablet: "/usr/bin/adb disconnect 192.168.0.113"
but I still get not found… stderr: "/bin/sh: /usr/bin/adb: not found"

Home Assistant is running inside a docker container. The terminal is running on the host os. So if you want ADB installed in the container, you’ll need to shell into the container from the terminal using a docker exec -it

1 Like

I got it, it is working now, installed into the docker homeassistant :smiley:
Thanks for the advice.

Excellent. Just be aware that the next time you upgrade HA you’ll get a new container and will need to reinstall it.

Ah… damn :frowning: There is no solution to keep what I installed? :frowning:

EDIT: I hope is working, I made another swtich :smiley:


- switch:
    name: ADB Tools State
    unique_id: adb_tools_state
    command_state: which adb
    value_template: "{{ 'adb' in value }}"
    command_on: apk add android-tools
    command_off: apk del android-tools

Then I will do an automation, if is not installed, it will be after :smiley:

Write an automation that installs it, run it when Home Assistant starts

Yes, this is what I did. That switch and an automation at HA stars. Thanks