Page 27 of 30

Re: dtgbot - Domoticz TeleGram BOT

Posted: Friday 12 August 2022 0:12
by mojso
maybe with a white list and a black list of Telegram ID, to filter the rooms (in the dtg menu, the living room button should show only the Telegram ID that is in the white list). it doesn't have to be blocked in the devices command as well

in dtgmenu.cfg I saw that it is possible to make a button that can be shown to those who are in the white list, but it is not possible to limit those who have loaded from domoticz

my idea is to filter dtgmenu not for security reasons, but for practical reasons

Re: dtgbot - Domoticz TeleGram BOT

Posted: Friday 12 August 2022 8:14
by jvdz
Are you running the very latest version MASTER version or the "Stability-and-new-install", which is really the one we should think about moving to MASTER with all its improvements and use of standard JSON & SSL available libraries?
I will see how difficult it is to make this optional feature to use only the specified rooms in an Domoticz User Variable.

Re: dtgbot - Domoticz TeleGram BOT

Posted: Friday 12 August 2022 9:52
by mojso
i think i use stability-and-new-install
jvdz wrote: Friday 12 August 2022 8:14 Are you running the very latest version MASTER version or the "Stability-and-new-install", which is really the one we should think about moving to MASTER with all its improvements and use of standard JSON & SSL available libraries?
I will see how difficult it is to make this optional feature to use only the specified rooms in an Domoticz User Variable.

Re: dtgbot - Domoticz TeleGram BOT

Posted: Friday 12 August 2022 16:51
by jvdz
I have had a little play with this idea and have some basics working. So when I add this Domoticz TelegramRoomsShownInMenu Variable:

Code: Select all

0=2,3,5,9,10|1111111=2,3,10|2222222=3,5
The way it currently works is that it will go down this decision path and the first line that is true will be used:
  • When The SendTo ID is found in the table the Rooms listed behind the = sign are shown for the ID.
  • When 0 (Considered Default for All) is found in the table the Rooms listed behind the = sign are shown. (2,3,5,9,10)
  • Else it will show all Rooms
I will do some more testing over the coming days when time permits and push an update when I am happy with the result.
Let mw know if you like the above approach or you think there is a better approach.

Jos

Re: dtgbot - Domoticz TeleGram BOT

Posted: Friday 12 August 2022 20:10
by mojso
I think it's great, maybe the same can be done with the devices

Re: dtgbot - Domoticz TeleGram BOT

Posted: Friday 12 August 2022 20:41
by jvdz
Rooms I think is simple to configure, but devices isn't that simple to maintain. IDX's change and maintaining stuff in Domoticz Variables is far for flexible due to their limitations.
It probably would make much more sense to connect an TelegramID to an UserID in Domoticz and let Domoticz handle which devices each user can see, but I do not have any setup that requires this, so thinks this is a nice task for somebody else to work on. I rather get this new Version/setup into production and get the docs completed for it (which is always a time-consuming task)

Please confirm you have the "stability-and-new-install" branch installed or else this room selection option won't be available.

Re: dtgbot - Domoticz TeleGram BOT

Posted: Friday 12 August 2022 20:52
by mojso
tell me how to check which version I have installed for sure
Lua-json installed
Lua-socket installed

Re: dtgbot - Domoticz TeleGram BOT

Posted: Friday 12 August 2022 21:17
by jvdz
Just compare the DTGBOT.lua file you run with the version in MASTER and "stability-and-new-install" branch.. there is a substantial difference. :)
The latter has "Version 0.9 20210113" at the top and is only 218 lines long.

Re: dtgbot - Domoticz TeleGram BOT

Posted: Friday 12 August 2022 21:31
by mojso
I have the master version Version 0.812 20201120,
send me a link for the last one stability-and-new-install please

Re: dtgbot - Domoticz TeleGram BOT

Posted: Friday 12 August 2022 21:47
by jvdz
It is in GitHub, just select the correct branchname from the drop-down selection list when you click Master.
It doesn't contain the changes yet and make sure you have a backup of your current setup first to ensure you can rollback easily.

Re: dtgbot - Domoticz TeleGram BOT

Posted: Saturday 13 August 2022 7:06
by mojso
now i have the latest version

and one more thing. it is good to stay. command " devices (devicename) st" to show the value
jvdz wrote: Friday 12 August 2022 21:47 It is in GitHub, just select the correct branchname from the drop-down selection list when you click Master.
It doesn't contain the changes yet and make sure you have a backup of your current setup first to ensure you can rollback easily.

Re: dtgbot - Domoticz TeleGram BOT

Posted: Saturday 13 August 2022 9:49
by jvdz
mojso wrote: Saturday 13 August 2022 7:06 and one more thing. it is good to stay. command " devices (devicename) st" to show the value
Unsure what you mean by this statement but assume it is an question where you like to see the current status of the device when using the devices command?
EDIT: I see I have it locally fixed already a long time ago but never pushed that to GITHUB.

Re: dtgbot - Domoticz TeleGram BOT

Posted: Saturday 13 August 2022 10:44
by jvdz
Just pushed the changes to GITHUB branch Stability-and-new-install:
Added Whitelist for menus per TelegramID
Fix for Devices <name> st
Added SYSTEMD service compatibility
Several Bash commands fixed
To Use MenuWhiteListing use the below:
jvdz wrote: Friday 12 August 2022 16:51 add this Domoticz TelegramRoomsShownInMenu Variable:

Code: Select all

0=2,3,5,9,10|1111111=2,3,10|2222222=3,5
The way it currently works is that it will go down this decision path and the first line that is true will be used:
  • When The SendTo ID is found in the table the Rooms listed behind the = sign are shown for the ID.
  • When 0 (Considered Default for All) is found in the table the Rooms listed behind the = sign are shown. (2,3,5,9,10)
  • Else it will show all Rooms

Re: dtgbot - Domoticz TeleGram BOT

Posted: Saturday 13 August 2022 16:11
by mojso
Very good my friend, It works great
jvdz wrote: Saturday 13 August 2022 10:44 Just pushed the changes to GITHUB branch Stability-and-new-install:
Added Whitelist for menus per TelegramID
Fix for Devices <name> st
Added SYSTEMD service compatibility
Several Bash commands fixed
To Use MenuWhiteListing use the below:
jvdz wrote: Friday 12 August 2022 16:51 add this Domoticz TelegramRoomsShownInMenu Variable:

Code: Select all

0=2,3,5,9,10|1111111=2,3,10|2222222=3,5
The way it currently works is that it will go down this decision path and the first line that is true will be used:
  • When The SendTo ID is found in the table the Rooms listed behind the = sign are shown for the ID.
  • When 0 (Considered Default for All) is found in the table the Rooms listed behind the = sign are shown. (2,3,5,9,10)
  • Else it will show all Rooms

Re: dtgbot - Domoticz TeleGram BOT

Posted: Saturday 13 August 2022 17:58
by jvdz
Great to hear it works for you!
While being in the code again, I am fulfilling my last big wish for the project: Merge the StandardTelegram Keyboard with the Inline-keyboard Branch and make the keyboard type selectable. This is also working now and could/should lead to a single Master branch again in stead of the multiple we have going now. :)
All That now needs to happen is to migrated all the different documents into a github wiki so we have it all in one place.
What say you @simonrg?

Jos

Re: dtgbot - Domoticz TeleGram BOT

Posted: Monday 05 September 2022 0:12
by Valiran
Hello I'm trying to install the bot and I'm facing the "wrong ELF class: ELFCLASS32" issue.
Installling lua-sec don't help :(

Do you have 64bit version of this files?

Re: dtgbot - Domoticz TeleGram BOT

Posted: Sunday 11 September 2022 19:03
by Valiran
OK, tried to reintall from github and now I have:

/usr/bin/lua: /home/valiran/dtgbot/dtgbot.lua:133: module 'JSON' not found:
no field package.preload['JSON']
no file '/usr/local/share/lua/5.2/JSON.lua'
no file '/usr/local/share/lua/5.2/JSON/init.lua'
no file '/usr/local/lib/lua/5.2/JSON.lua'
no file '/usr/local/lib/lua/5.2/JSON/init.lua'
no file '/usr/share/lua/5.2/JSON.lua'
no file '/usr/share/lua/5.2/JSON/init.lua'
no file './JSON.lua'
no file '/usr/local/lib/lua/5.2/JSON.so'
no file '/usr/lib/aarch64-linux-gnu/lua/5.2/JSON.so'
no file '/usr/lib/lua/5.2/JSON.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './JSON.so'
stack traceback:
[C]: in function 'require'
/home/valiran/dtgbot/dtgbot.lua:133: in main chunk
[C]: in ?

Didn't add the 2 archives in 1st post by the way, they seems to be mandatory :(

Package installed: lua5.2 / lua-json / lua-socket :(

Re: dtgbot - Domoticz TeleGram BOT

Posted: Sunday 11 September 2022 22:05
by jvdz
Did you install the "Stability-and-new-install" branch in stead of MASTER as that should work with those standard packages?

Re: dtgbot - Domoticz TeleGram BOT

Posted: Sunday 11 September 2022 23:00
by Valiran
I reinstalled everything specifying the branch and now it works !! That's great !

Now, I'm looking to customize the menu, do you have a link to a doc?

Re: dtgbot - Domoticz TeleGram BOT

Posted: Monday 12 September 2022 8:42
by jvdz
The dtgmenu.cfg file contains some comments about the different option I implemented.