Creating custom switch with adb

Hello

I have an old Nexus 10 Tab. WHich I am using as wall mount with the help of WallPanel app .
It have MQTT option to control screen brightness. I currently have it as switch to control the Nexus 10 brightness.

Turning it on and the brightness control works fine(Turning on works because it have setting do start a screen as screensaver after few minutes)
But turning the screen off does not work.

Is it possible to configure it in the way that only off command can be sent via adb for example “adb shell input keyevent 26” and other option like screen brightness can be controlled via MQTT all in one switch.

This is the configuration for the light switch

- platform: mqtt
  schema: template
  name: 'WallPanel Screen'
  state_topic: 'wallpanel/mywallpanel/state'
  state_template: '{% if value_json.screenOn == true %}on{% else %}off{% endif %}'
  brightness_template: '{{ value_json.brightness }}'
  command_topic: 'wallpanel/mywallpanel/command'
  command_on_template: >
    { "wake": true
    {%- if brightness is defined -%}
    ,"brightness": {{ brightness }}
    {%- endif -%}}
  command_off_template: '{ "wake": false }'
  json_attributes_topic: 'wallpanel/mywallpanel/state'