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: 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 »

Have you set the logging like i indicated a couple of posts up? http://www.domoticz.com/forum/viewtopic ... 865#p90255
This will generate a much more detailed log.
It could be an issue with the environment variables.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
hannibal2206
Posts: 10
Joined: Monday 08 August 2016 23:22
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Location: Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by hannibal2206 »

hmm .. after a reboot, the service auto-starts and it all seems to work !

After issuing a lot of commands, the process stops

dtbbot.log.errors output:

pi@raspberrypi3:~$ cat /var/tmp/dtb.log.errors
/usr/bin/lua5.2: /home/pi/dtgbot/dtgbot.lua:444: attempt to index local 'msg' (a nil value)
stack traceback:
/home/pi/dtgbot/dtgbot.lua:444: in function 'on_msg_receive'
/home/pi/dtgbot/dtgbot.lua:554: in main chunk
[C]: in ?


At that I need to reboot the PI to fix the situation; starting the service normally is not possible ..

Debuglevel is at 3
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 would have to see your dtb.log to see what it was doing at the time and maybe it has a clue what is going on.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
hannibal2206
Posts: 10
Joined: Monday 08 August 2016 23:22
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Location: Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by hannibal2206 »

First of all, thanks for helping out !

after a reboot it works fine for a while !!

When playing around with various commands the process crashes however after some time

pi@raspberrypi3:~$ cat /var/tmp/dtb.log.errors
/usr/bin/lua5.2: /home/pi/dtgbot/lua//dtgmenu.lua:696: attempt to index field '?' (a nil value)
stack traceback:
/home/pi/dtgbot/lua//dtgmenu.lua:696: in function 'handler'
/home/pi/dtgbot/dtgbot.lua:271: in function 'HandleCommand'
/home/pi/dtgbot/dtgbot.lua:460: in function 'on_msg_receive'
/home/pi/dtgbot/dtgbot.lua:554: in main chunk
[C]: in ?

Last portion of /var/tmp/dtb.log

2016-08-10 12:02:04 - Submenu item: (1) Woonkamer_(noord)
2016-08-10 12:02:04 - - Submenu item: (1) Woonkamer_(noord) (2) y (3) devices (4) 264 (5) 20.8°C - 62%
2016-08-10 12:02:04 - ==> start devinfo_from_name (1) 264 (2) Woonkamer (noord)
2016-08-10 12:02:04 - JSON request <http://192.168.1.223:8080/json.htm?type=devices&rid=264>
2016-08-10 12:02:04 - device (1) Woonkamer (noord) (2) Woonkamer (noord) (3) 264 (4) 264
2016-08-10 12:02:04 - !!!! found device (1) Woonkamer (noord) (2) Woonkamer (noord) (3) 264 (4) 264
2016-08-10 12:02:04 - !!!! found device (1) Woonkamer (noord) (2) 264
2016-08-10 12:02:04 - --< devinfo_from_name: (1) 1 (2) 264 (3) Woonkamer (noord) (4) devices (5) Temp + Humidity (7) 20.8°C - 62%
2016-08-10 12:02:04 - *Woonkamer_licht|KaKu1_Woonkamer_voor - On|KaKu3_Woonkamer_achter - Off|KaKu4_open_haard - Off|KaKu7_Woonkamer_dressoir - Off|Netatmo_Binnen - 47 dB|Netatmo_Binnen_() - nil|Onkyo_power - Off|Woonkamer_(noord) - 20.8°C - 62%|
2016-08-10 12:02:04 - Submenu item: (1) Woonkamer_(zuid)
2016-08-10 12:02:04 - - Submenu item: (1) Woonkamer_(zuid) (2) y (3) devices (4) 260 (5) 21.7°C - 59%
2016-08-10 12:02:04 - ==> start devinfo_from_name (1) 260 (2) Woonkamer (zuid)
2016-08-10 12:02:04 - JSON request <http://192.168.1.223:8080/json.htm?type=devices&rid=260>
2016-08-10 12:02:04 - device (1) Woonkamer (zuid) (2) Woonkamer (zuid) (3) 260 (4) 260
2016-08-10 12:02:04 - !!!! found device (1) Woonkamer (zuid) (2) Woonkamer (zuid) (3) 260 (4) 260
2016-08-10 12:02:04 - !!!! found device (1) Woonkamer (zuid) (2) 260
2016-08-10 12:02:04 - --< devinfo_from_name: (1) 1 (2) 260 (3) Woonkamer (zuid) (4) devices (5) Temp + Humidity (7) 21.7°C - 59%
2016-08-10 12:02:04 - *Woonkamer_licht|KaKu1_Woonkamer_voor - On|KaKu3_Woonkamer_achter - Off|KaKu4_open_haard - Off|KaKu7_Woonkamer_dressoir - Off|Netatmo_Binnen - 47 dB|Netatmo_Binnen_() - nil|Onkyo_power - Off|Woonkamer_(noord) - 20.8°C - 62%|Woonkamer_(zuid) - 21.7°C - 59%|
2016-08-10 12:02:04 - Submenu item: (1) licht_switch1
2016-08-10 12:02:04 - - Submenu item: (1) licht_switch1 (2) y (3) devices (4) 70 (5) Off
2016-08-10 12:02:04 - ==> start devinfo_from_name (1) 70 (2) woonkamer licht switch1
2016-08-10 12:02:04 - JSON request <http://192.168.1.223:8080/json.htm?type=devices&rid=70>
2016-08-10 12:02:04 - device (1) woonkamer licht switch1 (2) woonkamer licht switch1 (3) 70 (4) 70
2016-08-10 12:02:04 - !!!! found device (1) woonkamer licht switch1 (2) woonkamer licht switch1 (3) 70 (4) 70
2016-08-10 12:02:04 - !!!! found device (1) woonkamer licht switch1 (2) 70
2016-08-10 12:02:04 - --< devinfo_from_name: (1) 1 (2) 70 (3) woonkamer licht switch1 (4) devices (5) Lighting 2 (6) On/Off (7) Off
2016-08-10 12:02:04 - *Woonkamer_licht|KaKu1_Woonkamer_voor - On|KaKu3_Woonkamer_achter - Off|KaKu4_open_haard - Off|KaKu7_Woonkamer_dressoir - Off|Netatmo_Binnen - 47 dB|Netatmo_Binnen_() - nil|Onkyo_power - Off|Woonkamer_(noord) - 20.8°C - 62%|Woonkamer_(zuid) - 21.7°C - 59%|licht_switch1 - Off|
2016-08-10 12:02:04 - process buildmenu: (1) Off,On (2) w: (3) 8
2016-08-10 12:02:04 - -< buildmenu: (1) ["Off","On"]
2016-08-10 12:02:04 - |Onkyo_power - Off|Woonkamer_(noord) - 20.8°C - 62%|Woonkamer_(zuid) - 21.7°C - 59%|licht_switch1 - Off| (2) w: (3) 3
2016-08-10 12:02:04 - ","Onkyo_power - Off","Woonkamer_(noord) - 20.8°C - 62%"],["Woonkamer_(zuid) - 21.7°C - 59%","licht_switch1 - Off"]
2016-08-10 12:02:04 - process buildmenu: (1) menu (2) w: (3) 3
2016-08-10 12:02:04 - -< buildmenu: (1) ["menu"]
2016-08-10 12:02:04 - -< replymarkup:{"keyboard":[["Off","On"],["*Woonkamer_licht","KaKu1_Woonkamer_voor - On","KaKu3_Woonkamer_achter - Off"],["KaKu4_open_haard - Off","KaKu7_Woonkamer_dressoir - Off","Netatmo_Binnen - 47 dB"],["Netatmo_Binnen_() - nil","Onkyo_power - Off","Woonkamer_(noord) - 20.8°C - 62%"],["Woonkamer_(zuid) - 21.7°C - 59%","licht_switch1 - Off"],["menu"]],"selective":true,"resize_keyboard":true}
2016-08-10 12:02:04 - ==< Change KaKu1 Woonkamer voor => On
2016-08-10 12:02:04 - https://api.telegram.org/botxxx:keykey/ ... %3Atrue%7D
2016-08-10 12:02:04 - Message sent (1) 200
2016-08-10 12:02:04 - dtgbot: dtgmenu ended and text send ...return:200
2016-08-10 12:02:04 - Succesfully handled incoming request
.2016-08-10 12:02:10 - {"ok":true,"result":[{"update_id":783075445,
"message":{"message_id":671,"from":{"id":xxxxx,"first_name":"Han","last_name":"..","username":"Han_...."},"chat":{"id":1.....,"first_name":"Han","last_name":"...","username":"Han_.....","type":"private"},"date":1470823330,"text":"Off"}}]}
2016-08-10 12:02:10 - Message: 1
2016-08-10 12:02:10 - update_id (1) 783075445
2016-08-10 12:02:10 - TelegramBotOffset 783075446
2016-08-10 12:02:10 - JSON request <http://192.168.1.223:8080/json.htm?type ... =783075446>
2016-08-10 12:02:10 - WhiteList: 1...
2016-08-10 12:02:10 - Handle command function started with Off and 1.
2016-08-10 12:02:10 - dtgbot: Start DTGMENU ... (1) Off
2016-08-10 12:02:10 - ==> menu.lua process:Off
2016-08-10 12:02:10 - => SendTo: (1) 1....
2016-08-10 12:02:10 - => commandline : (1) Off
2016-08-10 12:02:10 - => command : (1) Off
2016-08-10 12:02:10 - => param1 : (1)
2016-08-10 12:02:10 - => Lastmenu submenu : (1) menu
2016-08-10 12:02:10 - |Onkyo_power - Off|Woonkamer_(noord) - 20.8°C - 62%|Woonkamer_(zuid) - 21.7°C - 59%|licht_switch1 - Off|
2016-08-10 12:02:10 - => Lastmenu actions : (1) Off,On
2016-08-10 12:02:10 - => Lastcmd prompt : (1) false
2016-08-10 12:02:10 - => Lastcmd submenu: (1) woonkamer
2016-08-10 12:02:10 - => Lastcmd device : (1) KaKu1_Woonkamer_voor
2016-08-10 12:02:10 - ChkInTable: (1) Off,On
2016-08-10 12:02:10 - |Onkyo_power - Off|Woonkamer_(noord) - 20.8°C - 62%|Woonkamer_(zuid) - 21.7°C - 59%|licht_switch1 - Off|
2016-08-10 12:02:10 - - ChkInTable not found: Off
2016-08-10 12:02:10 - ChkInTable: (1) menu
2016-08-10 12:02:10 - - ChkInTable not found: Off
2016-08-10 12:02:10 - => cmdisaction : (1) true
2016-08-10 12:02:10 - => cmdisbutton : (1) false
2016-08-10 12:02:10 - => cmdissubmenu: (1) false
2016-08-10 12:02:10 - => devicename : (1) KaKu1_Woonkamer_voor
2016-08-10 12:02:10 - => realdevicename : (1) KaKu1 Woonkamer voor
2016-08-10 12:02:10 - => idx: (1) 27
2016-08-10 12:02:10 - => Type : (1) Lighting 1
2016-08-10 12:02:10 - => DeviceType : (1) devices
2016-08-10 12:02:10 - => SwitchType : (1) On/Off
2016-08-10 12:02:10 - => MaxDimLevel : (1) 0
2016-08-10 12:02:10 - ChkInTable: (1) off,open
2016-08-10 12:02:10 - JSON request <http://192.168.1.223:8080/json.htm?type ... tchcmd=Off>
2016-08-10 12:02:10 - JSON feedback: (1) {
"status" : "OK",
"title" : "SwitchLight"
}

2016-08-10 12:02:10 - -< SwitchName: (1) KaKu1 Woonkamer voor (2) 27 (3) 200 (4) Change KaKu1 Woonkamer voor => Off
2016-08-10 12:02:10 - Start makereplymenu: (1) 1.... (2) devicemenu (3) woonkamer (4) KaKu1_Woonkamer_voor
2016-08-10 12:02:10 - -> makereplymenu Level: (1) devicemenu (2) submenu (3) woonkamer (4) devicename (5) KaKu1_Woonkamer_voor
2016-08-10 12:02:10 - submenu: woonkamer
2016-08-10 12:02:10 - Submenu item: (1) *Woonkamer_licht
2016-08-10 12:02:10 - - Submenu item: (1) *Woonkamer_licht (2) y (3) scenes (4) 3 (5)
2016-08-10 12:02:10 - --< devinfo_from_name: (1) 1 (2) 3 (3) Woonkamer licht (4) scenes (5) Group (6) Group (7)
2016-08-10 12:02:10 - *Woonkamer_licht|
2016-08-10 12:02:10 - Submenu item: (1) KaKu1_Woonkamer_voor
2016-08-10 12:02:10 - - Submenu item: (1) KaKu1_Woonkamer_voor (2) y (3) devices (4) 27 (5) Off
2016-08-10 12:02:10 - ==> start devinfo_from_name (1) 27 (2) KaKu1 Woonkamer voor
2016-08-10 12:02:10 - JSON request <http://192.168.1.223:8080/json.htm?type=devices&rid=27>
2016-08-10 12:02:10 - device (1) KaKu1 Woonkamer voor (2) KaKu1 Woonkamer voor (3) 27 (4) 27
2016-08-10 12:02:10 - !!!! found device (1) KaKu1 Woonkamer voor (2) KaKu1 Woonkamer voor (3) 27 (4) 27
2016-08-10 12:02:10 - !!!! found device (1) KaKu1 Woonkamer voor (2) 27
2016-08-10 12:02:10 - --< devinfo_from_name: (1) 1 (2) 27 (3) KaKu1 Woonkamer voor (4) devices (5) Lighting 1 (6) On/Off (7) Off
2016-08-10 12:02:10 - *Woonkamer_licht|KaKu1_Woonkamer_voor - Off|
2016-08-10 12:02:10 - ---< (1) Lighting 1 (2) On/Off (3) using replymarkup: (4)
2016-08-10 12:02:10 - -< On/Off using replymarkup: (1) Off,On
2016-08-10 12:02:10 - Submenu item: (1) KaKu3_Woonkamer_achter
2016-08-10 12:02:10 - - Submenu item: (1) KaKu3_Woonkamer_achter (2) y (3) devices (4) 29 (5) Off
2016-08-10 12:02:10 - ==> start devinfo_from_name (1) 29 (2) KaKu3 Woonkamer achter
2016-08-10 12:02:10 - JSON request <http://192.168.1.223:8080/json.htm?type=devices&rid=29>
2016-08-10 12:02:10 - device (1) KaKu3 Woonkamer achter (2) KaKu3 Woonkamer achter (3) 29 (4) 29
2016-08-10 12:02:10 - !!!! found device (1) KaKu3 Woonkamer achter (2) KaKu3 Woonkamer achter (3) 29 (4) 29
2016-08-10 12:02:10 - !!!! found device (1) KaKu3 Woonkamer achter (2) 29
2016-08-10 12:02:10 - --< devinfo_from_name: (1) 1 (2) 29 (3) KaKu3 Woonkamer achter (4) devices (5) Lighting 1 (6) On/Off (7) Off
2016-08-10 12:02:10 - *Woonkamer_licht|KaKu1_Woonkamer_voor - Off|KaKu3_Woonkamer_achter - Off|
2016-08-10 12:02:10 - Submenu item: (1) KaKu4_open_haard
2016-08-10 12:02:10 - - Submenu item: (1) KaKu4_open_haard (2) y (3) devices (4) 30 (5) Off
2016-08-10 12:02:10 - ==> start devinfo_from_name (1) 30 (2) KaKu4 open haard
2016-08-10 12:02:10 - JSON request <http://192.168.1.223:8080/json.htm?type=devices&rid=30>
2016-08-10 12:02:10 - device (1) KaKu4 open haard (2) KaKu4 open haard (3) 30 (4) 30
2016-08-10 12:02:10 - !!!! found device (1) KaKu4 open haard (2) KaKu4 open haard (3) 30 (4) 30
2016-08-10 12:02:10 - !!!! found device (1) KaKu4 open haard (2) 30
2016-08-10 12:02:10 - --< devinfo_from_name: (1) 1 (2) 30 (3) KaKu4 open haard (4) devices (5) Lighting 1 (6) On/Off (7) Off
2016-08-10 12:02:10 - *Woonkamer_licht|KaKu1_Woonkamer_voor - Off|KaKu3_Woonkamer_achter - Off|KaKu4_open_haard - Off|
2016-08-10 12:02:10 - Submenu item: (1) KaKu7_Woonkamer_dressoir
2016-08-10 12:02:10 - - Submenu item: (1) KaKu7_Woonkamer_dressoir (2) y (3) devices (4) 26 (5) Off
2016-08-10 12:02:10 - ==> start devinfo_from_name (1) 26 (2) KaKu7 Woonkamer dressoir
2016-08-10 12:02:10 - JSON request <http://192.168.1.223:8080/json.htm?type=devices&rid=26>
2016-08-10 12:02:10 - device (1) KaKu7 Woonkamer dressoir (2) KaKu7 Woonkamer dressoir (3) 26 (4) 26
2016-08-10 12:02:10 - !!!! found device (1) KaKu7 Woonkamer dressoir (2) KaKu7 Woonkamer dressoir (3) 26 (4) 26
2016-08-10 12:02:10 - !!!! found device (1) KaKu7 Woonkamer dressoir (2) 26
2016-08-10 12:02:10 - --< devinfo_from_name: (1) 1 (2) 26 (3) KaKu7 Woonkamer dressoir (4) devices (5) Lighting 1 (6) On/Off (7) Off
2016-08-10 12:02:10 - *Woonkamer_licht|KaKu1_Woonkamer_voor - Off|KaKu3_Woonkamer_achter - Off|KaKu4_open_haard - Off|KaKu7_Woonkamer_dressoir - Off|
2016-08-10 12:02:10 - Submenu item: (1) Netatmo_Binnen
2016-08-10 12:02:10 - - Submenu item: (1) Netatmo_Binnen (2) y (3) devices (4) 312 (5) 20.5°C - 70% - 1021.7hPa - Some Clouds
2016-08-10 12:02:10 - ==> start devinfo_from_name (1) 314 (2) Netatmo Binnen
2016-08-10 12:02:10 - JSON request <http://192.168.1.223:8080/json.htm?type=devices&rid=314>
2016-08-10 12:02:10 - device (1) Netatmo Binnen (2) Netatmo Binnen (3) 314 (4) 314
2016-08-10 12:02:10 - !!!! found device (1) Netatmo Binnen (2) Netatmo Binnen (3) 314 (4) 314
2016-08-10 12:02:10 - !!!! found device (1) Netatmo Binnen (2) 314
2016-08-10 12:02:10 - --< devinfo_from_name: (1) 1 (2) 314 (3) Netatmo Binnen (4) devices (5) General (7) 47 dB
2016-08-10 12:02:10 - *Woonkamer_licht|KaKu1_Woonkamer_voor - Off|KaKu3_Woonkamer_achter - Off|KaKu4_open_haard - Off|KaKu7_Woonkamer_dressoir - Off|Netatmo_Binnen - 47 dB|
2016-08-10 12:02:10 - Submenu item: (1) Netatmo_Binnen_()
2016-08-10 12:02:10 -
2016-08-10 12:02:10 - ==> start devinfo_from_name (1) 313 (2) Netatmo Binnen (woonkamer)
2016-08-10 12:02:10 - JSON request <http://192.168.1.223:8080/json.htm?type=devices&rid=313>
2016-08-10 12:02:10 - device (1) Netatmo Binnen (woonkamer) (2) Netatmo Binnen (woonkamer) (3) 313 (4) 313
2016-08-10 12:02:10 - !!!! found device (1) Netatmo Binnen (woonkamer) (2) Netatmo Binnen (woonkamer) (3) 313 (4) 313
2016-08-10 12:02:10 - !!!! found device (1) Netatmo Binnen (woonkamer) (2) 313
2016-08-10 12:02:10 -
2016-08-10 12:02:10 - *Woonkamer_licht|KaKu1_Woonkamer_voor - Off|KaKu3_Woonkamer_achter - Off|KaKu4_open_haard - Off|KaKu7_Woonkamer_dressoir - Off|Netatmo_Binnen - 47 dB|Netatmo_Binnen_() - nil|
2016-08-10 12:02:10 - Submenu item: (1) Onkyo_power
2016-08-10 12:02:10 - - Submenu item: (1) Onkyo_power (2) y (3) devices (4) 323 (5) Off
2016-08-10 12:02:10 - ==> start devinfo_from_name (1) 323 (2) Onkyo_power
2016-08-10 12:02:10 - JSON request <http://192.168.1.223:8080/json.htm?type=devices&rid=323>
2016-08-10 12:02:10 - device (1) Onkyo_power (2) Onkyo_power (3) 323 (4) 323
2016-08-10 12:02:10 - !!!! found device (1) Onkyo_power (2) Onkyo_power (3) 323 (4) 323
2016-08-10 12:02:10 - !!!! found device (1) Onkyo_power (2) 323
2016-08-10 12:02:10 - --< devinfo_from_name: (1) 1 (2) 323 (3) Onkyo_power (4) devices (5) Light/Switch (6) Media Player (7) Off
2016-08-10 12:02:10 - *Woonkamer_licht|KaKu1_Woonkamer_voor - Off|KaKu3_Woonkamer_achter - Off|KaKu4_open_haard - Off|KaKu7_Woonkamer_dressoir - Off|Netatmo_Binnen - 47 dB|Netatmo_Binnen_() - nil|Onkyo_power - Off|
2016-08-10 12:02:10 - Submenu item: (1) Woonkamer_(noord)
2016-08-10 12:02:10 - - Submenu item: (1) Woonkamer_(noord) (2) y (3) devices (4) 264 (5) 20.8°C - 62%
2016-08-10 12:02:10 - ==> start devinfo_from_name (1) 264 (2) Woonkamer (noord)
2016-08-10 12:02:10 - JSON request <http://192.168.1.223:8080/json.htm?type=devices&rid=264>
2016-08-10 12:02:10 - device (1) Woonkamer (noord) (2) Woonkamer (noord) (3) 264 (4) 264
2016-08-10 12:02:10 - !!!! found device (1) Woonkamer (noord) (2) Woonkamer (noord) (3) 264 (4) 264
2016-08-10 12:02:10 - !!!! found device (1) Woonkamer (noord) (2) 264
2016-08-10 12:02:10 - --< devinfo_from_name: (1) 1 (2) 264 (3) Woonkamer (noord) (4) devices (5) Temp + Humidity (7) 20.8°C - 62%
2016-08-10 12:02:10 - *Woonkamer_licht|KaKu1_Woonkamer_voor - Off|KaKu3_Woonkamer_achter - Off|KaKu4_open_haard - Off|KaKu7_Woonkamer_dressoir - Off|Netatmo_Binnen - 47 dB|Netatmo_Binnen_() - nil|Onkyo_power - Off|Woonkamer_(noord) - 20.8°C - 62%|
2016-08-10 12:02:10 - Submenu item: (1) Woonkamer_(zuid)
2016-08-10 12:02:10 - - Submenu item: (1) Woonkamer_(zuid) (2) y (3) devices (4) 260 (5) 21.7°C - 59%
2016-08-10 12:02:10 - ==> start devinfo_from_name (1) 260 (2) Woonkamer (zuid)
2016-08-10 12:02:10 - JSON request <http://192.168.1.223:8080/json.htm?type=devices&rid=260>
2016-08-10 12:02:10 - device (1) Woonkamer (zuid) (2) Woonkamer (zuid) (3) 260 (4) 260
2016-08-10 12:02:10 - !!!! found device (1) Woonkamer (zuid) (2) Woonkamer (zuid) (3) 260 (4) 260
2016-08-10 12:02:10 - !!!! found device (1) Woonkamer (zuid) (2) 260
2016-08-10 12:02:10 - --< devinfo_from_name: (1) 1 (2) 260 (3) Woonkamer (zuid) (4) devices (5) Temp + Humidity (7) 21.7°C - 59%
2016-08-10 12:02:10 - *Woonkamer_licht|KaKu1_Woonkamer_voor - Off|KaKu3_Woonkamer_achter - Off|KaKu4_open_haard - Off|KaKu7_Woonkamer_dressoir - Off|Netatmo_Binnen - 47 dB|Netatmo_Binnen_() - nil|Onkyo_power - Off|Woonkamer_(noord) - 20.8°C - 62%|Woonkamer_(zuid) - 21.7°C - 59%|
2016-08-10 12:02:10 - Submenu item: (1) licht_switch1
2016-08-10 12:02:10 - - Submenu item: (1) licht_switch1 (2) y (3) devices (4) 70 (5) Off
2016-08-10 12:02:10 - ==> start devinfo_from_name (1) 70 (2) woonkamer licht switch1
2016-08-10 12:02:10 - JSON request <http://192.168.1.223:8080/json.htm?type=devices&rid=70>
2016-08-10 12:02:10 - device (1) woonkamer licht switch1 (2) woonkamer licht switch1 (3) 70 (4) 70
2016-08-10 12:02:10 - !!!! found device (1) woonkamer licht switch1 (2) woonkamer licht switch1 (3) 70 (4) 70
2016-08-10 12:02:10 - !!!! found device (1) woonkamer licht switch1 (2) 70
2016-08-10 12:02:10 - --< devinfo_from_name: (1) 1 (2) 70 (3) woonkamer licht switch1 (4) devices (5) Lighting 2 (6) On/Off (7) Off
2016-08-10 12:02:10 - *Woonkamer_licht|KaKu1_Woonkamer_voor - Off|KaKu3_Woonkamer_achter - Off|KaKu4_open_haard - Off|KaKu7_Woonkamer_dressoir - Off|Netatmo_Binnen - 47 dB|Netatmo_Binnen_() - nil|Onkyo_power - Off|Woonkamer_(noord) - 20.8°C - 62%|Woonkamer_(zuid) - 21.7°C - 59%|licht_switch1 - Off|
2016-08-10 12:02:10 - process buildmenu: (1) Off,On (2) w: (3) 8
2016-08-10 12:02:10 - -< buildmenu: (1) ["Off","On"]
2016-08-10 12:02:10 - |Onkyo_power - Off|Woonkamer_(noord) - 20.8°C - 62%|Woonkamer_(zuid) - 21.7°C - 59%|licht_switch1 - Off| (2) w: (3) 3
2016-08-10 12:02:10 - ","Onkyo_power - Off","Woonkamer_(noord) - 20.8°C - 62%"],["Woonkamer_(zuid) - 21.7°C - 59%","licht_switch1 - Off"]
2016-08-10 12:02:10 - process buildmenu: (1) menu (2) w: (3) 3
2016-08-10 12:02:10 - -< buildmenu: (1) ["menu"]
2016-08-10 12:02:10 - -< replymarkup:{"keyboard":[["Off","On"],["*Woonkamer_licht","KaKu1_Woonkamer_voor - Off","KaKu3_Woonkamer_achter - Off"],["KaKu4_open_haard - Off","KaKu7_Woonkamer_dressoir - Off","Netatmo_Binnen - 47 dB"],["Netatmo_Binnen_() - nil","Onkyo_power - Off","Woonkamer_(noord) - 20.8°C - 62%"],["Woonkamer_(zuid) - 21.7°C - 59%","licht_switch1 - Off"],["menu"]],"selective":true,"resize_keyboard":true}
2016-08-10 12:02:10 - ==< Change KaKu1 Woonkamer voor => Off
2016-08-10 12:02:10 - https://api.telegram.org/bot....:keykey ... %3Atrue%7D
2016-08-10 12:02:10 - Message sent (1) 200
2016-08-10 12:02:10 - dtgbot: dtgmenu ended and text send ...return:200
2016-08-10 12:02:10 - Succesfully handled incoming request
.2016-08-10 12:02:20 - {"ok":true,"result":[{"update_id":783075446,
"message":{"message_id":673,"from":{"id":1...,"first_name":"Han","last_name":"...","username":"Han_..."},"chat":{"id":1.,"first_name":"Han","last_name":".....","username":"Han_.....","type":"private"},"date":1470823340,"text":"Woonkamer_(zuid) - 21.7\u00b0C - 59%"}}]}
2016-08-10 12:02:20 - Message: 1
2016-08-10 12:02:20 - update_id (1) 783075446
2016-08-10 12:02:20 - TelegramBotOffset 783075447
2016-08-10 12:02:20 - JSON request <http://192.168.1.223:8080/json.htm?type ... =783075447>
2016-08-10 12:02:20 - WhiteList: 1..
2016-08-10 12:02:20 - Handle command function started with Woonkamer_(zuid) - 21.7°C - 59% and 1.
2016-08-10 12:02:20 - dtgbot: Start DTGMENU ... (1) Woonkamer_(zuid) - 21.7°C - 59%
2016-08-10 12:02:20 - ==> menu.lua process:Woonkamer_(zuid) - 21.7°C - 59%
2016-08-10 12:02:20 - => SendTo: (1) 1..
2016-08-10 12:02:20 - => commandline : (1) Woonkamer_(zuid) - 21.7°C - 59%
2016-08-10 12:02:20 - => command : (1) Woonkamer_
2016-08-10 12:02:20 - => param1 : (1) zuid
2016-08-10 12:02:20 - => Lastmenu submenu : (1) menu
2016-08-10 12:02:20 - |Onkyo_power - Off|Woonkamer_(noord) - 20.8°C - 62%|Woonkamer_(zuid) - 21.7°C - 59%|licht_switch1 - Off|
2016-08-10 12:02:20 - => Lastmenu actions : (1) Off,On
2016-08-10 12:02:20 - => Lastcmd prompt : (1) false
2016-08-10 12:02:20 - => Lastcmd submenu: (1) woonkamer
2016-08-10 12:02:20 - => Lastcmd device : (1) KaKu1_Woonkamer_voor
2016-08-10 12:02:20 - ChkInTable: (1) Off,On
2016-08-10 12:02:20 - - ChkInTable not found: Woonkamer_(zuid) - 21.7°C - 59%
2016-08-10 12:02:20 - |Onkyo_power - Off|Woonkamer_(noord) - 20.8°C - 62%|Woonkamer_(zuid) - 21.7°C - 59%|licht_switch1 - Off|
2016-08-10 12:02:20 - ChkInTable: (1) menu
2016-08-10 12:02:20 - - ChkInTable not found: Woonkamer_(zuid) - 21.7°C - 59%
2016-08-10 12:02:20 - => cmdisaction : (1) false
2016-08-10 12:02:20 - => cmdisbutton : (1) true
2016-08-10 12:02:20 - => cmdissubmenu: (1) false
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 »

You have a pm. :-)

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
hannibal2206
Posts: 10
Joined: Monday 08 August 2016 23:22
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Location: Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by hannibal2206 »

Solved ! :D
hannibal2206
Posts: 10
Joined: Monday 08 August 2016 23:22
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Location: Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by hannibal2206 »

It appears you can have a maximum of 5 rooms defined ? I had 6, and 1 of them was not listed in the 'menu' overview
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 10 rooms defined and they are showing up fine, so guess you have hit another issue.
You know the drill when you want me to have a closer look. ;)

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
hannibal2206
Posts: 10
Joined: Monday 08 August 2016 23:22
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Location: Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by hannibal2206 »

Already found the lua/dtgmenu.cfg file, and changed the SubMenuWidth, DevMenuwidth and ActMenuwith from 3 to 5; that solved it for me ..
dakipro
Posts: 49
Joined: Thursday 17 December 2015 22:24
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: Norway
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by dakipro »

Hi, I just wanted to say thanks for making this functionality and wiki, I fallowed all the steps from the wiki and all played well from the first time. (except that I already had var/tmp, so I made ram drive as var/ram_tmp, and I am not a linux user).
It works great and is pretty much all man needs when it comes to controlling the home.
Cheers!
Raspberry Pi 2 B - MySensors (dimmers, switches, motion, temperature, lux, humidity sensors)
zWave (220v switches)
various 433 via RFLink
brianhunt
Posts: 8
Joined: Monday 26 September 2016 18:18
Target OS: -
Domoticz version:
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by brianhunt »

Looks very interesting (haven't installed it yet). I was only wondering if it is also possible to use this 'channel' for geofencing. If a geofancing app can send a message to a Telegram bot, I don't need to open up my domoticz system for direct url access.
Anybody any ideas?
delchrys
Posts: 51
Joined: Wednesday 02 March 2016 20:52
Target OS: -
Domoticz version:
Contact:

Re: RE: Re: dtgbot - Domoticz TeleGram BOT

Post by delchrys »

Slayer007 wrote: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.
Can you please share your script, on the meterstanden call in dtgbot. Really like to implement this in mine. But I need a example so I can see how it works.
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 »

@simonrg, @jvdz,

Since a few weeks I have an issue with dtgbot.
When I start the service (sudo service dtgbot start) I get the following error in the dtb.log.errors

Code: Select all

/usr/bin/lua5.2: /home/gerard/dtgbot/dtgbot.lua:565: attempt to index global 'msg' (a nil value)
stack traceback:
	/home/gerard/dtgbot/dtgbot.lua:565: in main chunk
	[C]: in ?
This refers to the "while file_exists(dtgbot_pid) do" of dtgbot.lua where line 565 is

Code: Select all

print_to_log(1,msg.text)
If I replace

Code: Select all

msg = tt['message']
by

Code: Select all

msg = ''
I can start dtgbot.
Then I change back the code to

Code: Select all

msg = tt['message']
and restart dtgbot, after that it works again.

But after some time I get the above error from the dtb.log.errors again and dtbgot is not working anymore.
Any ideas what could be the problem?
Not using Domoticz anymore
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 »

Could you show me the log that is created after you changed the TelegramBotLoglevel uservariable to 2 and the crash occurred? (PM is also fine)
This should show the received message from Telegram and hopefully will tell us the reason.

Jos
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 »

Sent you a PM with the (enormous) log.
Not using Domoticz anymore
Frank84
Posts: 3
Joined: Sunday 17 July 2016 11:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by Frank84 »

I've encountered a problem, receiving commando's stopped working today. Checked the status of dtgbot and it stated the following:

Code: Select all

pi@raspberrypi:/var/tmp$ sudo service dtgbot status
● dtgbot.service - LSB: A Telegram bot designed to control Domoticz
   Loaded: loaded (/etc/init.d/dtgbot)
   Active: active (running) since Mon 2017-02-13 18:04:23 CET; 4 days ago
  Process: 8838 ExecStop=/etc/init.d/dtgbot stop (code=exited, status=0/SUCCESS)
  Process: 8910 ExecStart=/etc/init.d/dtgbot start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/dtgbot.service
           ├─8916 /bin/sh /home/pi/dtgbot/dtgbot /var/run/dtgbot.pid
           └─8917 /usr/bin/lua /home/pi/dtgbot/dtgbot.lua

Feb 13 18:04:23 raspberrypi dtgbot[8910]: Starting Telegram Bot for Domoticz ... Done.
Feb 13 18:04:23 raspberrypi systemd[1]: Started LSB: A Telegram bot designed to control Domoticz.
Feb 13 18:04:24 raspberrypi sudo[8982]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/aptitude search ~U
Feb 13 18:04:24 raspberrypi sudo[8982]: pam_unix(sudo:session): session opened for user root by (uid=0)
Feb 13 18:04:29 raspberrypi sudo[8982]: pam_unix(sudo:session): session closed for user root
After stopping and starting the service it was working again.

Do you have any idea what would have caused this?

Code: Select all

pi@raspberrypi:/var/tmp$ sudo service dtgbot stop
pi@raspberrypi:/var/tmp$ sudo service dtgbot status
● dtgbot.service - LSB: A Telegram bot designed to control Domoticz
   Loaded: loaded (/etc/init.d/dtgbot)
   Active: inactive (dead) since Fri 2017-02-17 19:18:31 CET; 2s ago
  Process: 27213 ExecStop=/etc/init.d/dtgbot stop (code=exited, status=0/SUCCESS)
  Process: 8910 ExecStart=/etc/init.d/dtgbot start (code=exited, status=0/SUCCESS)

Feb 17 19:18:20 raspberrypi sudo[27542]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/ps x
Feb 17 19:18:20 raspberrypi sudo[27542]: pam_unix(sudo:session): session opened for user root by (uid=0)
Feb 17 19:18:20 raspberrypi sudo[27542]: pam_unix(sudo:session): session closed for user root
Feb 17 19:18:20 raspberrypi dtgbot[27213]: chk=1
Feb 17 19:18:25 raspberrypi sudo[27571]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/ps x
Feb 17 19:18:25 raspberrypi sudo[27571]: pam_unix(sudo:session): session opened for user root by (uid=0)
Feb 17 19:18:26 raspberrypi sudo[27571]: pam_unix(sudo:session): session closed for user root
Feb 17 19:18:26 raspberrypi dtgbot[27213]: chk=1
Feb 17 19:18:31 raspberrypi dtgbot[27213]: Done.
Feb 17 19:18:31 raspberrypi systemd[1]: Stopped LSB: A Telegram bot designed to control Domoticz.
pi@raspberrypi:/var/tmp$ sudo service dtgbot start
pi@raspberrypi:/var/tmp$ sudo service dtgbot status
● dtgbot.service - LSB: A Telegram bot designed to control Domoticz
   Loaded: loaded (/etc/init.d/dtgbot)
   Active: active (running) since Fri 2017-02-17 19:18:38 CET; 1s ago
  Process: 27213 ExecStop=/etc/init.d/dtgbot stop (code=exited, status=0/SUCCESS)
  Process: 27673 ExecStart=/etc/init.d/dtgbot start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/dtgbot.service
           ├─ 8917 /usr/bin/lua /home/pi/dtgbot/dtgbot.lua
           ├─27679 /bin/sh /home/pi/dtgbot/dtgbot /var/run/dtgbot.pid
           └─27680 /usr/bin/lua /home/pi/dtgbot/dtgbot.lua

Feb 17 19:18:38 raspberrypi dtgbot[27673]: Starting Telegram Bot for Domoticz ... Done.
Feb 17 19:18:38 raspberrypi systemd[1]: Started LSB: A Telegram bot designed to control Domoticz.

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 dtgbot.log.errors file should contain the error encountered as described in the wiki: https://www.domoticz.com/wiki/Remote_Co ... log.errors
Have you checked that?

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
corbin
Posts: 463
Joined: Saturday 20 August 2016 22:57
Target OS: Windows
Domoticz version: Beta
Location: Brisbane, Australia
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by corbin »

is there any plan to add telegram as a native plugin?
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
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 »

For which function? Notifications or remote commands?
The Notification part is already possible and doubt the commands part ever will as that doesn't sound like a core function for Domoticz to me.
Maybe simonrg has a different opinion.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
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 »

Not really core functionality, but it would be rather neat.

With the Python hardware plug in architecture it may be possible to build it in, I am not sue how it would work though as dtgbot needs to listen for commands and pass them into Domoticz.

Personally no plan currently to do this, and before anybody does we need to check it would have more advantages than disadvantages.
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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest