Page 29 of 30
Re: dtgbot - Domoticz TeleGram BOT
Posted: Saturday 03 June 2023 22:50
by mojso
dtgbot doesn't work with the latest domoticz update 15330
Re: dtgbot - Domoticz TeleGram BOT
Posted: Monday 05 June 2023 17:38
by jvdz
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.
Re: dtgbot - Domoticz TeleGram BOT
Posted: Monday 05 June 2023 21:32
by jvdz
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.
Re: dtgbot - Domoticz TeleGram BOT
Posted: Tuesday 06 June 2023 0:02
by simonrg
@jvdz fantastic work, thanks, sounds like a good approach, are we are the stage of version 2.0?
Re: dtgbot - Domoticz TeleGram BOT
Posted: Tuesday 06 June 2023 9:18
by jvdz
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.
Re: dtgbot - Domoticz TeleGram BOT
Posted: Thursday 15 February 2024 12:37
by pesa1234
jvdz 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.
I was not able to get it working until
or
I set the correct IP
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
then:
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...
but it don't work...
Re: dtgbot - Domoticz TeleGram BOT
Posted: Thursday 15 February 2024 15:20
by jvdz
pesa1234 wrote: ↑Thursday 15 February 2024 12:37
then:
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
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
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...
EDIT: I see that I have hardcoded that... will make a change for that and commit to github and let you know.
Re: dtgbot - Domoticz TeleGram BOT
Posted: Thursday 15 February 2024 16:10
by jvdz
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.
Re: dtgbot - Domoticz TeleGram BOT
Posted: Thursday 15 February 2024 18:03
by pesa1234
jvdz wrote: ↑Thursday 15 February 2024 15:20
pesa1234 wrote: ↑Thursday 15 February 2024 12:37
then:
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
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
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...
EDIT: I see that I have hardcoded that... will make a change for that and commit to github and let you know.
Yes, I change only port, but without change the IP it doesn't works
Thx translations works as expected.
Maybe also this is hardcoded?
on
Re: dtgbot - Domoticz TeleGram BOT
Posted: Thursday 15 February 2024 19:25
by jvdz
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.
Re: dtgbot - Domoticz TeleGram BOT
Posted: Thursday 15 February 2024 20:45
by pesa1234
jvdz wrote: ↑Thursday 15 February 2024 19:25
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.
Yes you're right!
Same thing also for
Thanks and sorry.
It is great the new script, I hope that version 2 will be released.
Thanks
Re: dtgbot - Domoticz TeleGram BOT
Posted: Thursday 15 February 2024 21:34
by jvdz
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.
Re: dtgbot - Domoticz TeleGram BOT
Posted: Thursday 15 February 2024 22:01
by pesa1234
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.
Ok ok, thanks a lot!
Re: dtgbot - Domoticz TeleGram BOT
Posted: Friday 16 February 2024 21:15
by jvdz
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:
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:"
}
},
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.
Re: dtgbot - Domoticz TeleGram BOT
Posted: Saturday 17 February 2024 10:54
by pesa1234
Perfect thanks created requested on github for italian translation
Re: dtgbot - Domoticz TeleGram BOT
Posted: Sunday 18 February 2024 17:49
by pesa1234
@jvdz why I get nil on setpoint value?
Where I'm wrong?
Code: Select all
Error:dtgmenuinline.lua:329: attempt to index field '?' (a nil value)
Re: dtgbot - Domoticz TeleGram BOT
Posted: Sunday 18 February 2024 18:46
by jvdz
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.
Re: dtgbot - Domoticz TeleGram BOT
Posted: Sunday 18 February 2024 19:04
by pesa1234
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'
How to enable debug? email, can you send me pm with email address?
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":[]}
full log...
https://pastebin.com/NeM1LCi2
Re: dtgbot - Domoticz TeleGram BOT
Posted: Sunday 18 February 2024 19:20
by jvdz
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.

Re: dtgbot - Domoticz TeleGram BOT
Posted: Sunday 18 February 2024 20:08
by pesa1234
jvdz wrote: ↑Sunday 18 February 2024 19:20
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.
Thanks is ok, but why I get nil°C on the menu? please have a look at the attachment and many thanks

- menu.jpg (17.79 KiB) Viewed 1563 times
these with nil are setpoint of my thermostat and for hot water, also other setpoint for clima control in summer have a nil