dtgbot - Domoticz TeleGram BOT

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

Moderator: leecollings

User avatar
jvdz
Posts: 2269
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 can have a look when you Set domoticz uservariable TelegramBotLoglevel to 99. restart dtgbot and then show this menu.
Then zip up the dtg.log and your config and email that to jvdzande AT yahoo DOT com.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
pesa1234
Posts: 18
Joined: Wednesday 05 December 2018 11:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Italy
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by pesa1234 »

jvdz wrote: Sunday 18 February 2024 20:14 I can have a look when you Set domoticz uservariable TelegramBotLoglevel to 99. restart dtgbot and then show this menu.
Then zip up the dtg.log and your config and email that to jvdzande AT yahoo DOT com.
Done

edit...

get back email wrong address, sent at the correct address just now.
DomoFlits
Posts: 39
Joined: Thursday 06 October 2016 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: Bld16583
Location: The Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by DomoFlits »

today migrated to a new Pi5
most of the functions are working again. but I can't get the DTGbot working
I followed the instructions in https://wiki.domoticz.com/Remote_Contro ... legram_Bot

The contents of dtb.log.errors is:

Code: Select all

/usr/bin/lua5.2: error loading module 'socket.core' from file '/usr/local/lib/lua/5.2/socket/core.so':
	/usr/local/lib/lua/5.2/socket/core.so: wrong ELF class: ELFCLASS32
stack traceback:
	[C]: in ?
	[C]: in function 'require'
	/usr/local/share/lua/5.2/socket.lua:12: in main chunk
	[C]: in function 'require'
	/usr/local/share/lua/5.2/socket/http.lua:10: in main chunk
	[C]: in function 'require'
	/home/pi/dtgbot/dtgbot.lua:130: in main chunk
	[C]: in ?
Google sends me in the direction that my pi is running on 64bit version, but LUA is in 32bit version.
I don't know how to solve this.
any help?
User avatar
jvdz
Posts: 2269
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 »

Please try this branch/version as that is much more stable and uses standard packages for ssl & json:
https://github.com/steps39/dtgbot/tree/ ... me-ov-file
Install instructions are on the readme page.

I am considering publishing the Docker version I have been using locally now for about a year, but probably will start that on my own github account in a separate repository. This gets rid of all this kind of dependencies and incompatibilities.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
DomoFlits
Posts: 39
Joined: Thursday 06 October 2016 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: Bld16583
Location: The Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by DomoFlits »

Thank you,
I have replaced the files for the newer files of your branch in /home/pi/dtgbot
I did

Code: Select all

sudo apt install lua5.2
sudo apt install lua-json
sudo apt install lua-socket
sudo apt install lua-sec
I have edited systemd-dtgbot.sh
I have created a file /etc/systemd/system/dtgbot.service and copied the contents of dtgbot.service in it and gave it a CHMOD 777
I did

Code: Select all

sudo systemctl enable dtgbot
sudo systemctl start dtgbot
but when i check the status with

Code: Select all

sudo service dtgbot status
I get

Code: Select all

● dtgbot.service - Telegram Bot for Domoticz
     Loaded: loaded (/etc/systemd/system/dtgbot.service; enabled; preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sun 2025-02-16 20:43:02 CET; 6s ago
    Process: 4176 ExecStart=sh /home/pi/dtgbot/systemd-dtgbot.sh (code=exited, status=1/FAILURE)
    Process: 4177 ExecStartPost=/bin/sh -c echo $MAINPID > /run/dtgbot.pid (code=exited, status=0/SUCCESS)
   Main PID: 4176 (code=exited, status=1/FAILURE)
so somehow the service won't start.
What did I do wrong?
Thanks for your help
User avatar
jvdz
Posts: 2269
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 »

Please send me the dtgbot.log so i can see what is going wrong. Youcan use the email address shown in github, or pm it to me as attachment.
Another option is to run it manually yourself so you can see any error messages.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
DomoFlits
Posts: 39
Joined: Thursday 06 October 2016 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: Bld16583
Location: The Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by DomoFlits »

Thanks for your answer
Unfortunately there is no dtgbot.log in /var/tmp/ (where I expect it)
Where to find it? Or how can I start it manually myself?
The

Code: Select all

sudo systemctl start dtgbot
doesn't appear to do something.
User avatar
jvdz
Posts: 2269
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 service starts dtgbot/systemd-dtgbot.sh and in there you define your information:

Code: Select all

#!/bin/bash
##### start script for dtgbot  ##################
## Define some system wide env variables
export DomoticzIP="127.0.0.1"
export DomoticzPort="8080"
export TempFileDir="/tmp/"
export BotHomePath="/home/pi/dtgbot/"
export BotBashScriptPath=$BotHomePath"bash/"
export BotLuaScriptPath=$BotHomePath"lua/"
export BotLuaLog=$TempFileDir"dtb.log"
export TelegramChatId='012343553'
export TelegramBotToken="000000000:keykeykeykeykeykeykeykey"
export EmailTo="[email protected]"
# Force use of Lua 5.2 or else lua socks will fail with ltn12 error
/usr/bin/lua5.2 $BotHomePath"dtgbot.lua" >$BotLuaLog 2>>$BotLuaLog.errors
Just check that file and see if all information is present and what is in there for the TempFileDir and BotLuaLog
To start it manually you change the directory to dtgbot and simply start systemd-dtgbot.sh.
To see the errors/log messages in the console you temporarily change the last line to:

Code: Select all

/usr/bin/lua5.2 $BotHomePath"dtgbot.lua"
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
DomoFlits
Posts: 39
Joined: Thursday 06 October 2016 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: Bld16583
Location: The Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by DomoFlits »

Code: Select all

export TempFileDir="/tmp/log"

export BotLuaLog=$TempFileDir"dtb.log"
commented the last part of the last line
then

Code: Select all

bash systemd-dtgbot.sh
gives:

Code: Select all


### Initialialisation process Failed:
Error-->error loading module 'socket.core' from file '/usr/local/lib/lua/5.2/socket/core.so':
        /usr/local/lib/lua/5.2/socket/core.so: wrong ELF class: ELFCLASS32stack traceback:
        /home/pi/dtgbot/dtgbot.lua:24: in function </home/pi/dtgbot/dtgbot.lua:23>
        [C]: in ?
        [C]: in function 'require'
        /usr/local/share/lua/5.2/socket.lua:12: in main chunk
        [C]: in function 'require'
        /usr/local/share/lua/5.2/socket/http.lua:10: in main chunk
        [C]: in function 'require'
        /home/pi/dtgbot/dtgbot.lua:42: in function </home/pi/dtgbot/dtgbot.lua:32>
        [C]: in function 'xpcall'
        /home/pi/dtgbot/dtgbot.lua:31: in main chunk
        [C]: in ?
/usr/bin/lua5.2: /home/pi/dtgbot/dtgbot.lua:106: Terminate DTGBOT as the initialisation failed, which frst needs to be fixed.
stack traceback:
        [C]: in function 'error'
        /home/pi/dtgbot/dtgbot.lua:106: in main chunk
        [C]: in ?
Last edited by DomoFlits on Sunday 23 February 2025 9:26, edited 1 time in total.
User avatar
jvdz
Posts: 2269
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 »

Looks like you need to remove the files you installed in the initial old setup you did, where you copied the downloaden version to that directory, as those seem to take preference over the newly installed version.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
DomoFlits
Posts: 39
Joined: Thursday 06 October 2016 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: Bld16583
Location: The Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by DomoFlits »

Thanks for your patience. Is your branch working on the 64bit OS of the pi5?
Btw, I am also a satisfied user of your garbage calendar script.
User avatar
jvdz
Posts: 2269
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 »

So does it work now? 😀

I've not tested it myself on a rpi5, but don't see any reason why not. It run also fine in a VM on my laptop.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
DomoFlits
Posts: 39
Joined: Thursday 06 October 2016 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: Bld16583
Location: The Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by DomoFlits »

I tried removed all traces of dtgbot first:

Code: Select all

sudo systemctl stop dtgbot
sudo systemctl disable dtgbot
sudo update-rc.d -f dtgbot remove
sudo rm /etc/init.d/dtgbot  
sudo rm /etc/systemd/system/dtgbot.service
sudo systemctl daemon-reload
sudo systemctl reset-failed
then delete everything in the dtgbot folder, replaced all files by your branch, updated system-dtgbot.sh

After that:

Code: Select all

cd ~/dtgbot
chmod 755 dtgbot
chmod 755 *.sh
cd ~/dtgbot/bash
chmod 755 *.sh
 
cd ~/dtgbot/service
sudo mv dtgbot.service /etc/systemd/system
cd ..
rmdir service
cd /etc/systemd/system
sudo chmod +x dtgbot.service
sudo systemctl enable dtgbot
sudo systemctl start dtgbot
then checked if it is working. but unfortunately is said failed to start

Code: Select all

sudo systemctl status dtgbot.service
dtgbot.service - Telegram Bot for Domoticz
Loaded: loaded (/etc/systemd/system/dtgbot.service; enabled; preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Tue 2025-02-18 20:04:05 CET; 7s ago
Process: 509928 ExecStart=sh /home/pi/dtgbot/systemd-dtgbot.sh (code=exited, status=1/FAILURE)
Process: 509929 ExecStartPost=/bin/sh -c echo $MAINPID > /run/dtgbot.pid (code=exited, status=0/>
Main PID: 509928 (code=exited, status=1/FAILURE)
CPU: 6ms

then started systemd-dtgbot.sh manual

and it gave the same output:

Code: Select all

### Initialialisation process Failed:
Error-->error loading module 'socket.core' from file '/usr/local/lib/lua/5.2/socket/core.so':
        /usr/local/lib/lua/5.2/socket/core.so: wrong ELF class: ELFCLASS32stack traceback:
        /home/pi/dtgbot/dtgbot.lua:24: in function </home/pi/dtgbot/dtgbot.lua:23>
        [C]: in ?
        [C]: in function 'require'
        /usr/local/share/lua/5.2/socket.lua:12: in main chunk
        [C]: in function 'require'
        /usr/local/share/lua/5.2/socket/http.lua:10: in main chunk
        [C]: in function 'require'
        /home/pi/dtgbot/dtgbot.lua:42: in function </home/pi/dtgbot/dtgbot.lua:32>
        [C]: in function 'xpcall'
        /home/pi/dtgbot/dtgbot.lua:31: in main chunk
        [C]: in ?
/usr/bin/lua5.2: /home/pi/dtgbot/dtgbot.lua:106: Terminate DTGBOT as the initialisation failed, which frst needs to be fixed.
stack traceback:
        [C]: in function 'error'
        /home/pi/dtgbot/dtgbot.lua:106: in main chunk
        [C]: in ?
for me: I now give up on dtgbot, since I've barely used it in the past (more like a gimmic). I normally acces my domotics server via VPN and then can control domotics in the normal interface.

Thanks for your patience and help
User avatar
jvdz
Posts: 2269
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 »

But did you reverse this step?: https://wiki.domoticz.com/Remote_Contro ... _Libraries
Removing the wrong lua libaries?
Just remove those and try .
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
DomoFlits
Posts: 39
Joined: Thursday 06 October 2016 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: Bld16583
Location: The Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by DomoFlits »

I have renamed the 5.2 folders:

Code: Select all

cd /usr/local/share/lua
sudo mv 5.2 old
and

Code: Select all

cd /usr/local/lib/lua
sudo mv 5.2 old
this indeed did the trick.
since when I did

Code: Select all

cd
cd dtgbot
bash systemd-dtgbot.sh
the feature finally started running (after setting the TempFileDir correct in systemd-dtgbot.sh)
8-)
thanks for your patience and help
User avatar
jvdz
Posts: 2269
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 »

DomoFlits wrote: Tuesday 18 February 2025 21:30 I have renamed the 5.2 folders:
-snip-
the feature finally started running (after setting the TempFileDir correct in systemd-dtgbot.sh)
8-)
thanks for your patience and help
Great ... enjoy :-)
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
jvdz
Posts: 2269
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 been working on a Docker version for DTGBOT, which will make the whole installation very simple and avoiding all these LUA & SSL incompatibilities we have seen the last couple of years. It also has a Web front-end to make the Log checking and basic configuration easier too.
The plan is to release it somewhere in the coming period, but could use some members to assist me with:
  • Testing the current available Docker version
  • Checking what is incorrect or missing in the current Wiki
Testing should be simple without destroying what you have now. You could simply stop the current Docker service and Create a Docker instance of DTGBOT following the documentation.
Please PM/Email me in case you are interested, after which I will point you to the right place.
Thanks Jos :-)

Some teasers:
DTGBOTIndex.png
DTGBOTIndex.png (181.86 KiB) Viewed 313 times
DTGBOTConfig_authorisation.png
DTGBOTConfig_authorisation.png (135.23 KiB) Viewed 313 times
DTGBOTMENU_keyboard_menu1 (Klein).png
DTGBOTMENU_keyboard_menu1 (Klein).png (287.77 KiB) Viewed 313 times
DTGBOTMENU_inline_menu1 (Klein).png
DTGBOTMENU_inline_menu1 (Klein).png (336.63 KiB) Viewed 313 times
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
jvdz
Posts: 2269
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 »

jvdz wrote: Tuesday 13 May 2025 16:00 ... but could use some members to assist me with:
  • Testing the current available Docker version
  • Checking what is incorrect or missing in the current Wiki
Anybody interested? :D
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest