dtgbot - Domoticz TeleGram BOT
Moderator: leecollings
-
- Posts: 92
- Joined: Friday 08 November 2019 23:07
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: dtgbot - Domoticz TeleGram BOT
dtgbot doesn't work with the latest domoticz update 15330
- jvdz
- Posts: 2209
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: dtgbot - Domoticz TeleGram BOT
This is due to the API call changes where since Revision 15326 the API calls for /json.htm?type=scenes & /json.htm?type=plans isn't supported anymore. /json.htm?type=devices is currently still supported generating an warning in the log.
I am looking at adding a call to get the Revision and based on the the returned Revision use either the OLD or NEW API format for them.
I am looking at adding a call to get the Revision and based on the the returned Revision use either the OLD or NEW API format for them.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
- jvdz
- Posts: 2209
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: dtgbot - Domoticz TeleGram BOT
I've committed a change which will support both the OLD and NEW formats to this branch: https://github.com/steps39/dtgbot/tree/ ... ew-install
My intend is to stop making any changes to the other branches and start a new topic with support for this branch only... But will first check with @simonrg first what he prefers.
My intend is to stop making any changes to the other branches and start a new topic with support for this branch only... But will first check with @simonrg first what he prefers.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- Posts: 329
- Joined: Tuesday 16 July 2013 22:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8807
- Location: North East England
- Contact:
Re: dtgbot - Domoticz TeleGram BOT
@jvdz fantastic work, thanks, sounds like a good approach, are we are the stage of version 2.0?
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
- jvdz
- Posts: 2209
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: dtgbot - Domoticz TeleGram BOT
That Branch is a total overhaul of the scripts so does justify changing the version to 2 for sure.
I have made one other change to the code for the OLD and NEW formats support. The retrieval of the Domoticz version is now the first API done, and Domoticz could need some time to finish starting up the API support, so I added the logic currently in the Domo_Variable_List() function to retries max 20 times in case nothing was returned for the API call. This update is committed to github.
I have made one other change to the code for the OLD and NEW formats support. The retrieval of the Domoticz version is now the first API done, and Domoticz could need some time to finish starting up the API support, so I added the logic currently in the Domo_Variable_List() function to retries max 20 times in case nothing was returned for the API call. This update is committed to github.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- 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
I was not able to get it working untiljvdz wrote: ↑Tuesday 06 June 2023 9:18 That Branch is a total overhaul of the scripts so does justify changing the version to 2 for sure.
I have made one other change to the code for the OLD and NEW formats support. The retrieval of the Domoticz version is now the first API done, and Domoticz could need some time to finish starting up the API support, so I added the logic currently in the Domo_Variable_List() function to retries max 20 times in case nothing was returned for the API call. This update is committed to github.
Code: Select all
export DomoticzIP="127.0.0.1"
Code: Select all
export DomoticzIP="username:[email protected]"
I have dtgbot and domoticz on same device...
My steps...
Code: Select all
sudo service dtgbot stop
cd ~
mv dtgbot olddtgbot
cd ~
git clone https://github.com/steps39/dtgbot.git
cd ~/dtgbot
git checkout Stability-and-new-install
sudo apt install lua5.2
sudo apt install lua-json
sudo apt install lua-socket
sudo apt install lua-sec
Edit systemd-dtgbot.sh:
Fill the proper info in the different fields
copy /service/dtgbot.service to /etc/systemd/system/dtgbot.service
enable the service:sudo systemctl enable dtgbot
start the service: sudo systemctl start dtgbot
One more question and sorry @jvdz how to translate back on menu... I've tried...
Code: Select all
["back"] = "Indietro",
- jvdz
- Posts: 2209
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: dtgbot - Domoticz TeleGram BOT
After you have done the last Setup step where you install the service, the IP of your domoticz should default to 127.0.0.1:8080 already:
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
EDIT: I see that I have hardcoded that... will make a change for that and commit to github and let you know.pesa1234 wrote: ↑Thursday 15 February 2024 12:37 One more question and sorry @jvdz how to translate back on menu... I've tried...but it don't work...Code: Select all
["back"] = "Indietro",
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
- jvdz
- Posts: 2209
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: dtgbot - Domoticz TeleGram BOT
Please have a look at the updated version for "Stability-and-new-install". Make sure you copy your modifications of dtgmenu.cfg before updating or copy it to dtgbot-user.cfg so it will never be overridden and update it with the language table changes.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- 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
Yes, I change only port, but without change the IP it doesn't worksjvdz wrote: ↑Thursday 15 February 2024 15:20After you have done the last Setup step where you install the service, the IP of your domoticz should default to 127.0.0.1:8080 already: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
EDIT: I see that I have hardcoded that... will make a change for that and commit to github and let you know.pesa1234 wrote: ↑Thursday 15 February 2024 12:37 One more question and sorry @jvdz how to translate back on menu... I've tried...but it don't work...Code: Select all
["back"] = "Indietro",
Thx translations works as expected.
Maybe also this is hardcoded?
Code: Select all
Exit_Menu
Code: Select all
dtgmenubottom.lua
- jvdz
- Posts: 2209
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: dtgbot - Domoticz TeleGram BOT
Guess you don't have 127.0.0.1 in the trusted networks then, but as long as it works its fine.
I need to think about that for a little longer and do some testing as the "Exit_Menu" is indeed hardcoded as button but also tested for as action.

I need to think about that for a little longer and do some testing as the "Exit_Menu" is indeed hardcoded as button but also tested for as action.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- 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
Yes you're right!
Same thing also for
Code: Select all
showmenu
It is great the new script, I hope that version 2 will be released.
Thanks
- jvdz
- Posts: 2209
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: dtgbot - Domoticz TeleGram BOT
There will be a limit to the freedom of commands and translation! I do not intent to change the way the menu is activated. I will look at the button text flexibility but even there it might be that some fixed texts will remain. I need to have a play with that idea and do some testing when time permits.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- 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
Ok ok, thanks a lot!jvdz wrote: ↑Thursday 15 February 2024 21:34 There will be a limit to the freedom of commands and translation! I do not intent to change the way the menu is activated. I will look at the button text flexibility but even there it might be that some fixed texts will remain. I need to have a play with that idea and do some testing when time permits.
- jvdz
- Posts: 2209
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: dtgbot - Domoticz TeleGram BOT
I have been looking at this and was able to add an option to add your own language start/stop menu commands and moved the "back" translation also to the new command section in the language table. This is how it looks now for each language:
This change is committed to the branch: Stability-and-new-install ( which will soon become the new Master)
Let me know if this is working as intended.
Code: Select all
-- English (Default) definition
["en"] = {
command = {
["back"] = "Back",
["menu"] = "Menu", -- define alternative for starting the menu
["exit_menu"] = "Exit_Menu" -- define alternative for exiting the menu.. also used as button text
},
switch_options = {
["On"] = "On,Close,Start",
["Off"] = "Off,Open"
},
devices_options = {
["Blinds"] = "Open,Close",
["Blinds Percentage"] = "Open,25%,50%,75%,Close",
["Scene"] = "Start",
["Group"] = "Off,On",
["On/Off"] = "Off,On",
["Push On Button"] = "On",
["Dimmer"] = "Off,On,25%,50%,75%,99%,?",
["Setpoint"] = "17,18,19,20,20.5,21,21.5,-,+,?",
["Thermostat"] = "17,18,19,20,20.5,21,21.5,-,+,?"
},
text = {
["start"] = "Hi, welcome to Domoticz.",
["main"] = "Select the submenu.",
["exit"] = "Exit Menu, type /menu to show it again",
["Select"] = "Select option.",
["SelectGroup"] = "Select the group option.",
["SelectScene"] = "Start scene?",
["SelectOptionwo"] = "Select new status.",
["SelectOption"] = "Select new status. Current status=",
["Specifyvalue"] = "Type value",
["Switched"] = "Change",
["UnknownChoice"] = "Unknown option:"
}
},
Let me know if this is working as intended.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- 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
Perfect thanks created requested on github for italian translation
-
- 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
@jvdz why I get nil on setpoint value?
Where I'm wrong?
Where I'm wrong?
Code: Select all
Error:dtgmenuinline.lua:329: attempt to index field '?' (a nil value)
- jvdz
- Posts: 2209
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: dtgbot - Domoticz TeleGram BOT
Are you running the latest versions of the scripts as that line makes no sense looking at the current version of dtgmenuinline.lua?
Latest is : dtgmenuinline_version = '0.9 202402161814'
If you have the latest the please enable the debugging, trigger the error and Email me the logfile so I can have a look.
Latest is : dtgmenuinline_version = '0.9 202402161814'
If you have the latest the please enable the debugging, trigger the error and Email me the logfile so I can have a look.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- 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
jvdz wrote: ↑Sunday 18 February 2024 18:46 Are you running the latest versions of the scripts as that line makes no sense looking at the current version of dtgmenuinline.lua?
Latest is : dtgmenuinline_version = '0.9 202402161814'
If you have the latest the please enable the debugging, trigger the error and Email me the logfile so I can have a look.
Code: Select all
dtgmenuinline_version = '0.9 202402161814'
When start
Code: Select all
2024-02-18 19:07:43 : Longpoll ended with status:200 response:nil
2024-02-18 19:07:43 : ### In contact with Telegram servers
2024-02-18 19:07:43 : Telegram response (1) {"ok":true,"result":[]}
https://pastebin.com/NeM1LCi2
- jvdz
- Posts: 2209
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: dtgbot - Domoticz TeleGram BOT
I think I found the issue, but there is no relation to a thermostat, but there were wrong Language variable names on that line. Just committed an update. Please check that and let me know if that fixes it. 

New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- 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
Thanks is ok, but why I get nil°C on the menu? please have a look at the attachment and many thanks
these with nil are setpoint of my thermostat and for hot water, also other setpoint for clima control in summer have a nil
Who is online
Users browsing this forum: No registered users and 0 guests