steps39 / dtgbot

Telegram Bot for Domoticz
19 stars 18 forks source link

How to handle "Push On Button" without additional press to "On" ? #21

Closed anyremote closed 7 months ago

anyremote commented 7 months ago

Say i have some "Push On Button"s in the menu :

   ["Switches"] = {whitelist="",showdevstatus="y",Menuwidth=2,
          buttons={
          ["B1"]        = {whitelist=""},
          ["B2"]        = {whitelist=""},
          ["B3"]        = {whitelist=""},
          ["B4"]        = {whitelist=""},
          }
    },

Then i press "B1" dtgbot shows additional button "On". And only if i press that "On" button it sends command to domoticz. Are there any possibility to do that at one click ? I mean if i press "B1" which is of "Push On Button" type, then dtgbot send command to domoticz immediately

jvanderzande commented 7 months ago

That is the way the dtgmenu works for the devices from domoticz present in rooms. It has 3 levels of menus which are automatically generated by the process:

  1. Rooms available
  2. Room level with devices
  3. Device level with possible options/settings for that device which you then can select.

For any exceptions you could create a bash file which can be defined like shown in the dtgmeny.cfg MISC menu.

anyremote commented 7 months ago

you could create a bash file which can be defined like shown in the dtgmen.cfg

Thanks. This solves the question how to run command. And produces another one.

Then i press one switch button from the list of switches i see in the log 2024-02-11 10:52:24 : ->run bash command script-button1.sh 123456789

My script return nothing, so i see in telegram Done. and dtgbot show menu with single "menu" item in the telegram.

To return to the list of switches again i have to choose "menu", and "switches" from top menu

so, the question is: how to stay on the same menu level after pressing the switch ?