dtgbot - Domoticz TeleGram BOT

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

Moderator: leecollings

Post Reply
Slayer007
Posts: 29
Joined: Wednesday 18 June 2014 23:57
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by Slayer007 »

The TelegramBotOffset. I changed the current value +1 as it says in the wiki. That worked for me.
Another thing, that (i think) is very nice. I implemented the custom keyboard to respons to telegram. I'm a rookie in scripting and get everything off the internet. I now place an extra line for the custom keyboard at the end of every bash script I make. Maybe it can be done in lua, so you get standaard a coupe of buttons to push. You don't need to type anymore. Just hit the button. I'll post a screenshot later on.
simonrg
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

Post by simonrg »

Slayer007 wrote:The TelegramBotOffset. I changed the current value +1 as it says in the wiki. That worked for me.
Another thing, that (i think) is very nice. I implemented the custom keyboard to respons to telegram. I'm a rookie in scripting and get everything off the internet. I now place an extra line for the custom keyboard at the end of every bash script I make. Maybe it can be done in lua, so you get standaard a coupe of buttons to push. You don't need to type anymore. Just hit the button. I'll post a screenshot later on.
Strange the error you were showing was due to Domoticz replying "not authorized" so by adding one to the offset you have skipped the command that caused the problem, but if do the same command again you should see the same error.

Jvdz (and I) is (are) In the process of implementing custom keyboards in dtgbot, it is in the menus branch of dtgbot on github, but not yet ready for mass consumption, as you say very neat, just trying to automate it and make it possible for others to use. Hope to have it on the wiki soon, why don't you document your approach on the wiki too, (if you haven't already).
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
Slayer007
Posts: 29
Joined: Wednesday 18 June 2014 23:57
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by Slayer007 »

Here a little example from my custom keyboard. This is a code in bash I put at the end of every bash script. The "id=" extract the username who asked for a command. So it says: How can I help you, user?

Code: Select all

id=`curl --data 'chat_id='$SendMsgTo --data-urlencode 'text='"$ResultString" 'https://api.telegram.org/bot'$TelegramBotToken'/sendMessage'| grep -Po ',"chat":{"id":.*,"first_name":"\K.*?(?=")'` 
sleep 1
curl --data 'chat_id='$SendMsgTo --data-urlencode 'reply_markup= {"keyboard":[["Coffee "],["Meterstanden"],[" Lights On "]]}' --data-urlencode 'text='"How can I help you, user_name"? 'https://api.telegram.org/bot'$TelegramBotToken'/sendMessage'
In the screenshot you see how it looks like.
Attachments
IMG_4111.PNG
IMG_4111.PNG (176.22 KiB) Viewed 7633 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 »

Let me share a "teaser" on what Simon and I have been working on in the last couple of weeks.
Please remember that this is still work in progress as we are also trying to make this as dynamic as possible to fit everybody's needs without too much manual config effort.
Base approach we have taken at this moment for dtgmenu's logic:
  • Read all Rooms from domoticz and make that the level 1 menu. (image 1)
  • Read all devices/scenes in the room and show them as buttons with their current status (image 2)
  • When you select a device, a 3rd level menu is shown at the top which gives you the pre-defined actions for the device type (image 2 middle/right)
  • Currently supports "Lighting 2" => Switch (On/Off) and Dimmers (On/Off and pre-defines levels) but also ? for a manual option to specify the level.
  • Also the option to just show the weather/ temperature info on a menu with buttons.(image 3)
  • Static options: This will allow for any bash/lua commands to start them via the menu with also the option to prompt for a parameter before running that command.
  • It does also have language support so the below Dutch standard replies will be available in any language we define and we plan to use the Domoticz settings as the language to use.
Stay tuned,
Jos
Image 1
Image 1
Image1.jpg (48.88 KiB) Viewed 7615 times
Image 2
Image 2
Image2.jpg (52.55 KiB) Viewed 7615 times
Image 3: Weather information
Image 3: Weather information
7.select-menu-weerinfo.jpg (17.68 KiB) Viewed 7615 times
Last edited by jvdz on Monday 24 August 2015 19:59, edited 1 time in total.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by G3rard »

That looks great! I hope this can be shared soon.
Not using Domoticz anymore
Slayer007
Posts: 29
Joined: Wednesday 18 June 2014 23:57
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by Slayer007 »

Looks really great. Can't wait to implement this. Keep up the good work!

Can anyone help me. I have a little bit problems with the command. I have multiple bash-scripts, for example:
meter.sh
system.sh
morning.sh
room.sh
living_room.sh

When I send a textmessage to my bot, for example "m", it executes all scripts.
When I send a message "ro", then it execute's morning.sh and room.sh. And when I send "em" it executes meter/system.sh.
The same with "room". Sending a message "room" will execute both scripts with room in it.

Is there anyway to send a message wich only executes the exact match? Or can I make my own commands? For example: When I send a message "Sunny", it will execute system.sh?

I'm trying to understand the script, but I can't really see what I have to adapt?
(and can you please send an example of your lua-script that handles the custom keyboard, so I already can play with it?)
simonrg
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

Post by simonrg »

Slayer007 wrote:When I send a textmessage to my bot, for example "m", it executes all scripts.
When I send a message "ro", then it execute's morning.sh and room.sh. And when I send "em" it executes meter/system.sh.
The same with "room". Sending a message "room" will execute both scripts with room in it.

Is there anyway to send a message wich only executes the exact match? Or can I make my own commands? For example: When I send a message "Sunny", it will execute system.sh?

I'm trying to understand the script, but I can't really see what I have to adapt?
(and can you please send an example of your lua-script that handles the custom keyboard, so I already can play with it?)
Messages should only be executing with exact match ignoring case, it looks like you might have something funny with the prefix character, have you set it for your bot on Telegram?

Below is an example function from @jvdz of a Lua function which uses a custom keyboard within Lua, using curl to do the https communications.

The function will send a message to one or both of the people based on names with the given user codes.

Code: Select all

— Send Telegram Bot message
— sendid can be a send2userx name or their id and also be send2both to send to both telegram accounts
— the function will also minimise the Keyboard to just the Menu button
function TelegramMsg(sendto,message)
 token = "yourbottoken"
 usercode1 = 12343567
 usercode2 = 12345678
  send2both = "both"
  send2user1 = "Henk"
  send2user2 = "Greta"

 reply_markup = '--data-urlencode \"reply_markup={\\\"keyboard\\\":[[\\\"menu\\\"]],\\\"resize_keyboard\\\":true}\"'
 if (sendto == 'Both' or sendto == send2user1 or sendto == usercode1) then
  os.execute('curl —data chat_id='..usercode1.. ' —data-urlencode "text='..message..'" '..reply_markup..' "https://api.telegram.org/bot'..token..'/sendMessage" ')
 end
 if (sendto == 'Both' or sendto == send2user2 or sendto == usercode2) then
  os.execute('curl —data chat_id='..usercode2..' —data-urlencode "text='..message..'" '..reply_markup..' "https://api.telegram.org/bot'..token..'/sendMessage" ')
 end
end
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
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 »

This is an updated version which will only send the reply_markup when the dtgmenu is enabled.

Cheers
Jos

Code: Select all

-- Send Telegram Bot message
-- sendid can be a send2userx name or their id and also be send2both to send to both telegram accounts
-- the function will also minimise the Keyboard to just the Menu button
function TelegramMsg(sendto,message)
  token = "yourbottoken"
  usercode1 = 12343567
  usercode2 = 12345678
  send2both = "both"
  send2user1 = "Henk"
  send2user2 = "Greta"
  reply_markup = ""
  --
  -- Check whether the dtgmenu is switched on and only then send the reply_markup
  if uservariables['TelegramBotMenu'] == "On" then
    reply_markup = '--data-urlencode \"reply_markup={\\\"keyboard\\\":[[\\\"menu\\\"]],\\\"resize_keyboard\\\":true}\"'
  end
  -- check and send to user1
  if (sendto == send2both or sendto == send2user1 or sendto == usercode1) then
    os.execute('curl —data chat_id='..usercode1.. ' —data-urlencode "text='..message..'" '..reply_markup..' "https://api.telegram.org/bot'..token..'/sendMessage" ')
  end
  -- check and send to user2
  if (sendto == send2both or sendto == send2user2 or sendto == usercode2) then
    os.execute('curl —data chat_id='..usercode2..' —data-urlencode "text='..message..'" '..reply_markup..' "https://api.telegram.org/bot'..token..'/sendMessage" ')
  end
end
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
rjnl
Posts: 14
Joined: Friday 27 June 2014 11:08
Target OS: Linux
Domoticz version: Beta
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by rjnl »

Hi,

I've installed the bot according to the latest wiki. However I am getting the following error when starting the service:

Code: Select all

domoticz@domoticz:/var/tmp$ cat dtb.log.errors 
/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: [b]wrong ELF class: ELFCLASS32[/b]
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/domoticz/dtgbot/dtgbot.lua:92: in main chunk
	[C]: in ?
Edit: Fixed by manually compiling and installing luasocket, luasec, luajson so they are 64-bit compatible. Now however, I get this error, for which i have no idea what to do :) Seems to me like a bug in lua-json...

Code: Select all

/usr/bin/lua5.2: /usr/local/share/lua/5.2/json/util.lua:55: bad argument #1 to 'pairs' (table expected, got string)
stack traceback:
	[C]: in function 'pairs'
	/usr/local/share/lua/5.2/json/util.lua:55: in function </usr/local/share/lua/5.2/json/util.lua:50>
	(...tail calls...)
	/usr/local/share/lua/5.2/json/decode.lua:108: in function </usr/local/share/lua/5.2/json/decode.lua:107>
	(...tail calls...)
	/usr/local/share/lua/5.2/json/decode.lua:157: in function </usr/local/share/lua/5.2/json/decode.lua:156>
	(...tail calls...)
	/home/domoticz/dtgbot//dtg_domoticz.lua:40: in function 'variable_list'
	/home/domoticz/dtgbot//dtg_domoticz.lua:47: in function 'variable_list_names_idxs'
	/home/domoticz/dtgbot/dtgbot.lua:172: in function 'dtgbot_initialise'
	/home/domoticz/dtgbot/dtgbot.lua:229: in main chunk
	[C]: in ?
savage007
Posts: 19
Joined: Sunday 13 September 2015 20:24
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by savage007 »

Hi,

how can i control Domoticz from an url? When i send a message through https://api.telegram.org/bot11111111:BB ... 78&text=0N 2

Domoticz doesnt respond, it looks like dtgbot doesnt listen to the messages that are sent throug the bots account instead of my own.
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 »

Won't you create an endless message loop when you send a message to the Bot account from the Bot Account as DTGBOT will reply with a success/failure message, and how would you know whether or not it was successful?

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
savage007
Posts: 19
Joined: Sunday 13 September 2015 20:24
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by savage007 »

Is it possible to send a message from a url/http request as the user instead of the bot?
simonrg
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

Post by simonrg »

savage007 wrote:Hi,

how can i control Domoticz from an url? When i send a message through https://api.telegram.org/bot11111111:BB ... 78&text=0N 2

Domoticz doesnt respond, it looks like dtgbot doesnt listen to the messages that are sent throug the bots account instead of my own.
I guess you would need to create another Bot and then send the message from there to common group chat.

If you think about it there is no way for the bot to know whether Domoticz sent the bot message or another instance of the bot sent the message.
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
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 »

savage007 wrote:Is it possible to send a message from a url/http request as the user instead of the bot?
I am not sure what the exact underlying goal is of your question, but in general I would say JSON is the way to go for URL links to change devices in Domoticz.
Sending an telegram message via an URL feels more like a workaround for something that is already available directly, but maybe you can share the scenario you are thinking of?

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
mschut
Posts: 108
Joined: Sunday 23 February 2014 21:40
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.5613
Location: Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by mschut »

I feel stupid, but I followed the complet wiki (at least I think I did), but it isn't working YET.

The log dtg.log shows

Code: Select all

2015-09-28 23:34:21 - DomoticzIP: X.X.X.X
2015-09-28 23:34:21 - DomoticzPort: 8080
2015-09-28 23:34:21 - BotHomePath: /home/pi/dtgbot/
2015-09-28 23:34:21 - BotLuaScriptPath: /home/pi/dtgbot/lua/
2015-09-28 23:34:21 - BotBashScriptPath: /home/pi/dtgbot/bash/
2015-09-28 23:34:21 - TelegramBotToken: 11111111:KEYKEYKEYKEYKEYKEY
2015-09-28 23:34:21 - TelegramBotOffset: TelegramBotOffset
2015-09-28 23:34:21 - -----------------------------------------
2015-09-28 23:34:21 - Starting Telegram api Bot message handler
2015-09-28 23:34:21 - -----------------------------------------
The log dtg.log.errors says:

Code: Select all

/usr/bin/lua5.2: /home/pi/dtgbot/dtgbot.lua:92: module 'socket.http' not found:
        no field package.preload['socket.http']
        no file '/usr/local/share/lua/5.2/socket/http.lua'
        no file '/usr/local/share/lua/5.2/socket/http/init.lua'
        no file '/usr/local/lib/lua/5.2/socket/http.lua'
        no file '/usr/local/lib/lua/5.2/socket/http/init.lua'
        no file './socket/http.lua'
        no file '/usr/share/lua/5.2/socket/http.lua'
        no file '/usr/share/lua/5.2/socket/http/init.lua'
        no file './socket/http.lua'
        no file '/usr/local/lib/lua/5.2/socket/http.so'
        no file '/usr/lib/arm-linux-gnueabihf/lua/5.2/socket/http.so'
        no file '/usr/lib/lua/5.2/socket/http.so'
        no file '/usr/local/lib/lua/5.2/loadall.so'
        no file './socket/http.so'
        no file '/usr/local/lib/lua/5.2/socket.so'
        no file '/usr/lib/arm-linux-gnueabihf/lua/5.2/socket.so'
        no file '/usr/lib/lua/5.2/socket.so'
        no file '/usr/local/lib/lua/5.2/loadall.so'
        no file './socket.so'
stack traceback:
        [C]: in function 'require'
        /home/pi/dtgbot/dtgbot.lua:92: in main chunk
        [C]: in ?
My bet: my lua 5.2 is not complete? Is there some easy way to fix this?

Regards
simonrg
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

Post by simonrg »

mschut wrote:My bet: my lua 5.2 is not complete? Is there some easy way to fix this?
Installation is not plug and play and all of it has to work for any of it to work.

Looks like you haven't got the Lua libraries installed correctly, repeat this part of the wiki instructions, and that should fix it:
http://www.domoticz.com/wiki/Remote_Con ... _Libraries
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
mschut
Posts: 108
Joined: Sunday 23 February 2014 21:40
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.5613
Location: Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by mschut »

Wow, thanks. So simple, now it's working like a charm!
satanasinc
Posts: 41
Joined: Monday 19 October 2015 12:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: Spain
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by satanasinc »

Hi!

First of all. excuse my bad english. :oops:

After install Telegrambot i cant start the service.
I cant find where is the problem. Anybody can help me please?. :?

Here is my log file.

dtb.log.errors
Spoiler: show
/usr/bin/lua5.2: /usr/local/share/lua/5.2/JSON.lua:383: html passed to JSON:decode(): <html><head><title>Bad Request</title></head><body><h1>400 Bad Request</h1></body></html>
stack traceback:
[C]: in function 'assert'
/usr/local/share/lua/5.2/JSON.lua:383: in function 'onDecodeOfHTMLError'
/usr/local/share/lua/5.2/JSON.lua:655: in function 'decode'
/home/pi/dtgbot//dtg_domoticz.lua:113: in function 'device_list'
/home/pi/dtgbot/lua//dtgmenu.lua:407: in function 'MakeRoomMenus'
/home/pi/dtgbot/lua//dtgmenu.lua:382: in function 'PopulateMenuTab'
/home/pi/dtgbot/dtgbot.lua:210: in function 'dtgbot_initialise'
/home/pi/dtgbot/dtgbot.lua:229: in main chunk
[C]: in ?
and dtb.log
Spoiler: show
2015-10-19 12:45:28 - DomoticzIP: 192.168.X.XXXX
2015-10-19 12:45:28 - DomoticzPort: 8080
2015-10-19 12:45:28 - BotHomePath: /home/pi/dtgbot/
2015-10-19 12:45:28 - BotLuaScriptPath: /home/pi/dtgbot/lua/
2015-10-19 12:45:28 - BotBashScriptPath: /home/pi/dtgbot/bash/
2015-10-19 12:45:28 - TelegramBotToken: 123456789:XXXXXXXXXXXXXXXXXXXXXXXXXX
2015-10-19 12:45:28 - TelegramBotOffset: 1
2015-10-19 12:45:28 - -----------------------------------------
2015-10-19 12:45:28 - Starting Telegram api Bot message handler
2015-10-19 12:45:28 - -----------------------------------------
2015-10-19 12:45:28 - Domoticz returned getuservariables after 1 attempts
2015-10-19 12:45:29 - dtgbotLogLevel set to: 0
2015-10-19 12:45:29 - Loading command modules...
2015-10-19 12:45:29 - Loading module <utility>
2015-10-19 12:45:29 - found command <refresh>
2015-10-19 12:45:29 - Loading module <dtgmenu>
2015-10-19 12:45:29 - define LastCommand
2015-10-19 12:45:29 - Domoticz language is not available for dtgmenus
2015-10-19 12:45:29 - found command <dtgmenu>
2015-10-19 12:45:29 - Loading module <list>
2015-10-19 12:45:29 - found command <list>
2015-10-19 12:45:29 - found command <dump>
2015-10-19 12:45:29 - Loading module <devices>
2015-10-19 12:45:29 - found command <devices>
2015-10-19 12:45:29 - found command <scenes>
2015-10-19 12:45:29 - Loading module <flick>
2015-10-19 12:45:29 - found command <flick>
2015-10-19 12:45:29 - Loading module <nflick>
2015-10-19 12:45:29 - found command <nflick>
2015-10-19 12:45:29 - Loading module <on>
2015-10-19 12:45:29 - found command <on>
2015-10-19 12:45:29 - found command <off>
2015-10-19 12:45:29 - Loading module <battery>
2015-10-19 12:45:29 - found command <batteries>
2015-10-19 12:45:29 - found command <battery>
2015-10-19 12:45:29 - Loading module <help>
2015-10-19 12:45:29 - found command <start>
2015-10-19 12:45:29 - found command <help>
2015-10-19 12:45:29 - Loading module <temperature>
2015-10-19 12:45:29 - found command <tempall>
2015-10-19 12:45:29 - found command <temperature>
2015-10-19 12:45:29 - found command <temperatures>
2015-10-19 12:45:29 - Decoded On
IP and telegramtoken cchanged.

Thanx and greeting from spain.
satanasinc
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 seems there is an issue retrieving the Room information for the defined rooms in Domoticz.
How many rooms do you have defined?
Could you :
  • create the uservariable: TelegramBotLoglevel as Integer
  • Set TelegramBotLoglevel to: 1
  • Start dtgbot and post the logs again as that should now show more details.
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
satanasinc
Posts: 41
Joined: Monday 19 October 2015 12:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: Spain
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by satanasinc »

jvdz wrote:It seems there is an issue retrieving the Room information for the defined rooms in Domoticz.
How many rooms do you have defined?
Could you :
  • create the uservariable: TelegramBotLoglevel as Integer
  • Set TelegramBotLoglevel to: 1
  • Start dtgbot and post the logs again as that should now show more details.
Jos
Hi!

jvdz thanks for your help. ;)

Two rooms configured in domoticz.

I added the variable to domoticz with these result...

dtb.log
Spoiler: show
2015-10-20 10:00:11 - DomoticzIP: 192.168.1.XXX
2015-10-20 10:00:11 - DomoticzPort: 8080
2015-10-20 10:00:11 - BotHomePath: /home/pi/dtgbot/
2015-10-20 10:00:11 - BotLuaScriptPath: /home/pi/dtgbot/lua/
2015-10-20 10:00:11 - BotBashScriptPath: /home/pi/dtgbot/bash/
2015-10-20 10:00:11 - TelegramBotToken: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
2015-10-20 10:00:11 - TelegramBotOffset: 1
2015-10-20 10:00:11 - -----------------------------------------
2015-10-20 10:00:11 - Starting Telegram api Bot message handler
2015-10-20 10:00:11 - -----------------------------------------
2015-10-20 10:00:11 - Domoticz returned getuservariables after 1 attempts
2015-10-20 10:00:11 - Decoded 1
2015-10-20 10:00:11 - dtgbotLogLevel set to: 1
2015-10-20 10:00:11 - Loading command modules...
2015-10-20 10:00:11 - Loading module <utility>
2015-10-20 10:00:11 - found command <refresh>
2015-10-20 10:00:11 - Loading module <dtgmenu>
2015-10-20 10:00:11 - define LastCommand
2015-10-20 10:00:11 - Domoticz language is not available for dtgmenus
2015-10-20 10:00:11 - found command <dtgmenu>
2015-10-20 10:00:11 - Loading module <list>
2015-10-20 10:00:11 - found command <list>
2015-10-20 10:00:11 - found command <dump>
2015-10-20 10:00:11 - Loading module <devices>
2015-10-20 10:00:11 - found command <devices>
2015-10-20 10:00:11 - found command <scenes>
2015-10-20 10:00:11 - Loading module <flick>
2015-10-20 10:00:11 - found command <flick>
2015-10-20 10:00:11 - Loading module <nflick>
2015-10-20 10:00:11 - found command <nflick>
2015-10-20 10:00:11 - Loading module <on>
2015-10-20 10:00:11 - found command <on>
2015-10-20 10:00:11 - found command <off>
2015-10-20 10:00:11 - Loading module <battery>
2015-10-20 10:00:11 - found command <battery>
2015-10-20 10:00:11 - found command <batteries>
2015-10-20 10:00:11 - Loading module <help>
2015-10-20 10:00:11 - found command <help>
2015-10-20 10:00:11 - found command <start>
2015-10-20 10:00:11 - Loading module <temperature>
2015-10-20 10:00:11 - found command <tempall>
2015-10-20 10:00:11 - found command <temperatures>
2015-10-20 10:00:11 - found command <temperature>
2015-10-20 10:00:11 - JSON request <http://192.168.1.XXX:8080/json.htm?type ... able&idx=9>
2015-10-20 10:00:11 - Decoded On
2015-10-20 10:00:11 - #### Start populating menuarray
2015-10-20 10:00:11 - Submenu table including buttons defined in menu.cfg: (1) 1 (2)
2015-10-20 10:00:11 - => (1) Misc (2) (3) n (4) 3
2015-10-20 10:00:11 - static -> (1) Misc (2) refresh (3) (4) 9999 (5) command (6) command (7) command (8) 100 (9)
2015-10-20 10:00:11 - static -> (1) Misc (2) battery (3) (4) 9999 (5) command (6) command (7) command (8) 100 (9)
2015-10-20 10:00:11 - static -> (1) Misc (2) tempall (3) (4) 9999 (5) command (6) command (7) command (8) 100 (9)
2015-10-20 10:00:11 - static -> (1) Misc (2) batteries (3) (4) 9999 (5) command (6) command (7) command (8) 100 (9)
2015-10-20 10:00:11 - static -> (1) Misc (2) systemstatus (3) (4) 9999 (5) command (6) command (7) command (8) 100 (9)
2015-10-20 10:00:11 - static -> (1) Misc (2) dtgmenu (3) (4) 9999 (5) command (6) command (7) command (8) 100 (9)
2015-10-20 10:00:11 - Creating Room Menus: (1) 1 (2)
2015-10-20 10:00:11 - JSON request <http://192.168.1.XXX:8080/json.htm?type ... idx=Planta Baja&order=name&used=true>
dtb.log.error
Spoiler: show
[C]: in function 'assert'
/usr/local/share/lua/5.2/JSON.lua:383: in function 'onDecodeOfHTMLError'
/usr/local/share/lua/5.2/JSON.lua:655: in function 'decode'
/home/pi/dtgbot//dtg_domoticz.lua:113: in function 'device_list'
/home/pi/dtgbot/lua//dtgmenu.lua:407: in function 'MakeRoomMenus'
/home/pi/dtgbot/lua//dtgmenu.lua:382: in function 'PopulateMenuTab'
/home/pi/dtgbot/dtgbot.lua:210: in function 'dtgbot_initialise'
/home/pi/dtgbot/dtgbot.lua:229: in main chunk
[C]: in ?
Thank you again jvdz.

Greetings from spain
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest