LukeSkywalker92 / TeleFrame

TeleFrame - a digital picture frame for telegram
MIT License
93 stars 28 forks source link

Toggle Screenn On / Off over Telegram #134

Closed tommy86geis closed 4 years ago

tommy86geis commented 4 years ago

Is ist possible to switch Display on and off over telegram?

kris711 commented 4 years ago

Hi yes this works. Please check

screenConfig
toggleMonitor
turnOnHour
turnOffHour

in config\config.json

Trenar commented 4 years ago

You can check what toggles your display (trace down the toggleMonitor key, kris711 mentioned above) and execute these commands as an admin action. This is what I did

tommy86geis commented 4 years ago

ok, how can i check that out? can you give me your code? i don't know how the admin action is working.

Trenar commented 4 years ago

providing my code would not help, since I use a very special display, that works a little different (Sunfounder 10.1")

Have a look at the files in /config/screens/. I guess, you're using a default HDMI screen (i.e. using hdmi_default.js). There you find the bash commands for turning on and off the screen's backlight (cmdBacklightOff and cmdBacklightOn). With these commands you can add two admin actions to your config file. See the readme for how to use admin actions or look at the examples in the /js/defaultConfig.js. Your config should be extended with something like this:

whitelistAdmins: [YOUR CHAT ID],
adminAction: {
    //Global Switch to enable the Admin-Actions
    allowAdminAction: true,
      //Defines an array of action-objects
      actions: [
        // Admin-Action for starting the OpenVPN-Client
        {name: "turnDisplayOff", command: "tvservice -o", enable: true},
        // Admin-Action for stoping the OpenVPN-Client
        {name: "turnDisplayOn", command: "tvservice --preferred && sudo chvt 6 && sudo chvt 7", enable: true}
    ]
  }
kris711 commented 4 years ago

maybe its easier: Which hardware (Monitor) do you use?

tommy86geis commented 4 years ago

I use a normal Monitor over HDMI. Only Switch Signal Off and on. So the Monitor switch off If there is no Signal

Trenar commented 4 years ago

Good. In this case, the config lines I suggested above should work for you. To toggle your monitor, send "/turnDisplayOff" or "/turnDisplayOn" to your bot

tommy86geis commented 4 years ago

It is working perfectly. Thanks a Lot