dtgbot - Domoticz TeleGram BOT

Client tools or tools that can connect with Domoticz. Tools for Windows, iOS, Android, Linux etc.

Moderator: leecollings

mojso
Posts: 86
Joined: Friday 08 November 2019 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post 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
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post 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.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
mojso
Posts: 86
Joined: Friday 08 November 2019 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post 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.
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post 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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
mojso
Posts: 86
Joined: Friday 08 November 2019 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by mojso »

I think it's great, maybe the same can be done with the devices
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post 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.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
mojso
Posts: 86
Joined: Friday 08 November 2019 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by mojso »

tell me how to check which version I have installed for sure
Lua-json installed
Lua-socket installed
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post 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.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
mojso
Posts: 86
Joined: Friday 08 November 2019 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by mojso »

I have the master version Version 0.812 20201120,
send me a link for the last one stability-and-new-install please
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post 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.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
mojso
Posts: 86
Joined: Friday 08 November 2019 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post 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.
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post 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.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post 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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
mojso
Posts: 86
Joined: Friday 08 November 2019 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post 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
Attachments
First user
First user
IMG-1015e890cba5eb1ec5a1ef7c39d1f5c4-V.jpg (27.53 KiB) Viewed 1554 times
second user
second user
Screenshot_20220813-164956_Telegram.jpg (93.12 KiB) Viewed 1554 times
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post 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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Valiran
Posts: 13
Joined: Thursday 17 February 2022 0:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post 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?
Valiran
Posts: 13
Joined: Thursday 17 February 2022 0:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post 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 :(
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by jvdz »

Did you install the "Stability-and-new-install" branch in stead of MASTER as that should work with those standard packages?
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Valiran
Posts: 13
Joined: Thursday 17 February 2022 0:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post 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?
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by jvdz »

The dtgmenu.cfg file contains some comments about the different option I implemented.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests