Telegram does not show devices

Moderator: leecollings

Post Reply
Duan
Posts: 9
Joined: Saturday 20 February 2016 8:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Telegram does not show devices

Post by Duan »

Hello all,

I'm really enjoying the effort the guys put into telegram for Domoticz. I have followed these two wiki's:
- https://www.domoticz.com/wiki/Installin ... ion_System
- https://www.domoticz.com/wiki/Telegram_ ... ctionality

Sending messages from Domotics works like a charm and I also get response when I for example send "checkdomoticzupdate".
But I can' get a list of devices also can't control them

The log file seems alright and when I check the json api for devices I do get a valid output.
http://192.168.XXX.XXX:8080/json.htm?ty ... order=Name

I also saw the telegrambot wiki, does that mean the wiki's that I used were deprecated?
- https://www.domoticz.com/wiki/Telegram_Bot
- https://www.domoticz.com/wiki/Remote_Co ... legram_Bot

Additional info:
Spoiler: show
Domotics version 3.530

/etc/profile.d/DomoticzData.sh

Code: Select all

export DomoticzIP=$(hostname -I|sed 's/[ ]*$//')
export DomoticzPort="8080"
export TempFileDir="/var/tmp/"
export TelegramHomePath="/home/pi/tg/"
export TelegramScriptPath=$TelegramHomePath"scripts/user/"
export TelegramGenericPath=$TelegramHomePath"scripts/generic/"
export TelegramScript=$TelegramGenericPath"telegram.sh"
export TelegramCli=$TelegramHomePath"bin/telegram-cli"
export TelegramLog=$TempFileDir"tg.log"
export ReceiveLua=$TelegramGenericPath"receive.lua"
export TelegramTo="XXX"
export [email protected]"
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: Telegram does not show devices

Post by jvdz »

They should still be valid and things are working fine for me. To debug simply set the Domoticz Uservariable TelegramBotLoglevel to 2 and look in the dtb.log for the result and errors. You can also PM it to me in case you want some help with sorting it out.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: Telegram does not show devices

Post by woody4165 »

I've got same issue then I followed Jos post here http://www.domoticz.com/forum/viewtopic ... bot#p87136

Don't know why, but this modification is not in the main files you download at post #1, for me it worked.
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Telegram does not show devices

Post by Derik »

Still get a error:

Code: Select all

make: *** Er is geen regel om doel 'tgl/tl-parser/crc32.c' te maken, nodig voor 'objs/crc32.o'.  Gestopt.
By the install of:

Code: Select all

./configure && make     # Takes aprox. 30-45 minutes for a RPI-B
./configure && make -j4 # Takes aprox.  8-9  minutes for a RPI-2B
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
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: Telegram does not show devices

Post by jvdz »

@Derik, Are you not following the Telegram BOT install wiki as that doesn't require any local build of any commandline tool?

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Telegram does not show devices

Post by Derik »

jvdz wrote:@Derik, Are you not following the Telegram BOT install wiki as that doesn't require any local build of any commandline tool?

Jos
Jos
The BOT version is hard to get for me.
And i was thinking that i need this option for the BOT to
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
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: Telegram does not show devices

Post by jvdz »

It really is pretty strait forward to setup when you follow first this wiki: https://www.domoticz.com/wiki/Telegram_Bot
After that you need to follow this wiki to be able to send commands: https://www.domoticz.com/wiki/Remote_Co ... legram_Bot

Simon and I have further developed this version of DTGBOT and also has the option to use the Buttons/Menu available in Telegram.
Just follow it step by step and it can function next to your existing setup while installing.

So where are you getting stuck?
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Telegram does not show devices

Post by Derik »

Got a Bot:
Got the update:
ScreenShot069.jpg
ScreenShot069.jpg (18.31 KiB) Viewed 1702 times
Only i cannot find the chatid:
ScreenShot070.jpg
ScreenShot070.jpg (73.31 KiB) Viewed 1701 times
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Duan
Posts: 9
Joined: Saturday 20 February 2016 8:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Telegram does not show devices

Post by Duan »

Try to chat with your bot first and go the the link again. If you don't chat with your bot it can't give you results back which contains the chatId
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Telegram does not show devices

Post by Derik »

i did chat and i have my id:-)
Only how can i send 1 message to multiple users [ group ]

I cannot set the bot as admin, like the wiki says
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Duan
Posts: 9
Joined: Saturday 20 February 2016 8:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Telegram does not show devices

Post by Duan »

I had the same problem, I don't that it is possible to make the bot admin in an already existing group.
Bots are frequently added to groups in order to augment communication between human users, e.g. by providing news, notifications from external services or additional search functionality. This is especially true for work-related groups. Now, when you share a group with a bot, you tend to ask yourself “How can I be sure that the little rascal isn't selling my chat history to my competitors?” The answer is — privacy mode.

A bot running in privacy mode will not receive all messages that people send to the group. Instead, it will only receive:

Messages that start with a slash ‘/’ (see Commands above)
Replies to the bot's own messages
Service messages (people added or removed from the group, etc.)
- https://core.telegram.org/bots#privacy-mode

Workaround:
- Typ something in the group that starts with a slash like: "/hello"
- Get update: https://api.telegram.org/bot784324329:E ... getUpdates
- Fetch ID, for example: -123456789
- Try it out: https://api.telegram.org/bot784324329:E ... 9&text=123
Duan
Posts: 9
Joined: Saturday 20 February 2016 8:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Telegram does not show devices

Post by Duan »

Back to subject. I used the wiki's Jos recommended, but could not start the bot because of another device error:
/usr/bin/lua5.2: /home/pi/dtgbot//dtg_domoticz.lua:125: attempt to get length of global 'result' (a nil value)
stack traceback:
/home/pi/dtgbot//dtg_domoticz.lua:125: in function 'device_list_names_idxs'
/home/pi/dtgbot/dtgbot.lua:175: in function 'dtgbot_initialise'
/home/pi/dtgbot/dtgbot.lua:229: in main chunk
[C]: in ?
Quickfix:
- Sudo nano /home/pi/dtgbot/dtg_domoticz.lua
- Search for the function "device_list_names_idxs(DeviceType)" (around line 118)
Spoiler: show
-- returns a list of Domoticz items based on type i.e. devices or scenes
function device_list_names_idxs(DeviceType)
--returns a devcie idx based on its name
local idx, k, record, decoded_response
decoded_response = device_list(DeviceType)
result = decoded_response['result']
devices = {}
devicesproperties = {}
for i = 1, #result do
record = result
if type(record) == "table" then
if DeviceType == "plans" then
devices[record['Name']] = record['idx']
else
devices[string.lower(record['Name'])] = record['idx']
devices[record['idx']] = record['Name']
if DeviceType == 'scenes' then
devicesproperties[record['idx']] = {Type=record['Type'], SwitchType = record['Type']}
end
end
end
end
return devices, devicesproperties
end

- Add "if result ~= nil then" before the for loop and another "end" above te return.
Or you could replace the whole method with the code below
Spoiler: show
-- returns a list of Domoticz items based on type i.e. devices or scenes
function device_list_names_idxs(DeviceType)
--returns a devcie idx based on its name
local idx, k, record, decoded_response
decoded_response = device_list(DeviceType)
result = decoded_response['result']
devices = {}
devicesproperties = {}
if result ~= nil then
for i = 1, #result do
record = result
if type(record) == "table" then
if DeviceType == "plans" then
devices[record['Name']] = record['idx']
else
devices[string.lower(record['Name'])] = record['idx']
devices[record['idx']] = record['Name']
if DeviceType == 'scenes' then
devicesproperties[record['idx']] = {Type=record['Type'], SwitchType = record['Type']}
end
end
end
end
end
return devices, devicesproperties
end
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest