dtgbot - Domoticz TeleGram BOT

Client tools or tools that can connect with Domoticz. Tools for Windows, iOS, Android, Linux etc.
User avatar
blackdog65
Posts: 535
Joined: Tuesday 17 June 2014 18:25
Target OS: Raspberry Pi
Domoticz version:
Location: Norfolk, UK
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by blackdog65 » Wednesday 20 April 2016 21:57

Hi guys,
Very impressed and many thanks for the hard work.

It's taken some time and reading, but finally got it up and running.. YAY!

There's one thing missing ( or more likely I missed it. ) Is there any way to list devices by room idx rather than room name?
For example: I have a room called "heating" that contains all my CH, HW, TRV, Stats and Temps in one place. It would be nice to call the list up easily.

Any tips?

Sean
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E

User avatar
jvdz
Posts: 1062
Joined: Tuesday 30 December 2014 20:25
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Westland/Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by jvdz » Friday 22 April 2016 17:12

Hi Sean,
I guess you are talking about the menu functionallity which uses the room definitions as the bases for building the menu structure?
Dtgmenu also has the ability to define menu items manually, but there is no other option available than that.
I am also not sure what you are looking for and how that would function in the current setup. Could elaborate on what you mean?

Jos

User avatar
blackdog65
Posts: 535
Joined: Tuesday 17 June 2014 18:25
Target OS: Raspberry Pi
Domoticz version:
Location: Norfolk, UK
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by blackdog65 » Friday 22 April 2016 17:59

A "room" created in Setup/more-options/plans/roomplans is allocated an Idx (i.e. $Hidden Devices is Idx 1).
With dtgbot I can input "scenes" and get a list of scenes, it would be very useful (to me) to be able to input "rooms" to see a roomplan list or better still, input a roomplan name i.e. "Sitting room" and see that room's devices listed.

As I say, this may well exist but I didn't see it. :oops:

Also "define menu items manually"??? NICE! But where/how? :?

Many thanks for getting back to me

Sean
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E

User avatar
jvdz
Posts: 1062
Joined: Tuesday 30 December 2014 20:25
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Westland/Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by jvdz » Friday 22 April 2016 18:14

Ok, it looks like you are not talking about the dtgmenu functionality but about commands that can be used in the core dtgbot functionality written by simonrg.
I was talking about the menu stuff i wrote and integrated together with simonrg into the dtgbot setup shown earlier in this thread: http://www.domoticz.com/forum/viewtopic ... 100#p52245

I'll leave it to simonrg to comment on your question.

ps: I am currently looking at changing the DTGMenu setup from the keyboard setup to the newly available in-line keyboard functionality as that makes the whole setup more flexible and dynamic.

User avatar
blackdog65
Posts: 535
Joined: Tuesday 17 June 2014 18:25
Target OS: Raspberry Pi
Domoticz version:
Location: Norfolk, UK
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by blackdog65 » Friday 22 April 2016 19:28

Many thanks again for your help,
the dtg menu looks more useful, is there any documentation yet? I can't find any.

Keep up the great work :D

Sean
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E

User avatar
blackdog65
Posts: 535
Joined: Tuesday 17 June 2014 18:25
Target OS: Raspberry Pi
Domoticz version:
Location: Norfolk, UK
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by blackdog65 » Sunday 24 April 2016 14:33

Ah... if I change the variable TelegramBotMenu from "on" to "On" it works :oops:
Why oh why do I always get tripped up by these tiny errors? :roll:
Ok now to release dtgbot on the wife ;)
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E

User avatar
jvdz
Posts: 1062
Joined: Tuesday 30 December 2014 20:25
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Westland/Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by jvdz » Sunday 24 April 2016 18:53

I am still in develop mode, but have most of the basic running for the inline-keyboard functionality of Telegram, available in Bot API 2.0.
Here is a sneak peak of how it currently looks:
Image1.jpg
Inline DTGBOT
Image1.jpg (43.12 KiB) Viewed 1295 times
More to follow soon,
Jos

User avatar
blackdog65
Posts: 535
Joined: Tuesday 17 June 2014 18:25
Target OS: Raspberry Pi
Domoticz version:
Location: Norfolk, UK
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by blackdog65 » Sunday 24 April 2016 22:54

Looking good!
Will multi-position/selector switches work? Currently they just show off and on (in Dutch).
This is rapidly becoming a cool control panel.

Sean
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E

User avatar
jvdz
Posts: 1062
Joined: Tuesday 30 December 2014 20:25
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Westland/Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by jvdz » Monday 25 April 2016 17:47

blackdog65 wrote:Will multi-position/selector switches work?
I have the basics also running for the selector switch in the new version.
Hadn't looked at it yet and indeed required some changes in the process.

Jos

User avatar
blackdog65
Posts: 535
Joined: Tuesday 17 June 2014 18:25
Target OS: Raspberry Pi
Domoticz version:
Location: Norfolk, UK
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by blackdog65 » Tuesday 26 April 2016 20:20

Many many thanks! I'll be trying it soon

Sean
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E

woody4165
Posts: 499
Joined: Monday 14 March 2016 14:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by woody4165 » Wednesday 27 April 2016 14:58

Hi and thanks for sharing this!!!

I've followed the guide at "Remote Control of Domoticz by Telegram Bot" but I'm getting error when launching the service:

Code: Select all

sudo service dtgbot start
Failed to start dtgbot.service: Unit dtgbot.service failed to load: No such file or directory.
and the last row in /var/tmp/dtb.log is:

Code: Select all

2016-04-27 14:47:28 - /var/run/dtgbot.pid does not exist, so exiting
What mistake I made during installation?

Thanks

User avatar
jvdz
Posts: 1062
Joined: Tuesday 30 December 2014 20:25
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Westland/Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by jvdz » Wednesday 27 April 2016 15:02

I guess you missed a step in the setup process as defined in the Wiki. :)
Just check you did all steps listed here:
https://www.domoticz.com/wiki/Remote_Co ... ot_Scripts
and
https://www.domoticz.com/wiki/Remote_Co ... ot_Service

Jos

woody4165
Posts: 499
Joined: Monday 14 March 2016 14:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by woody4165 » Wednesday 27 April 2016 15:42

Don't know what I missed, but repeating those three command, now it's working.

Code: Select all

sudo chmod +x dtgbot
sudo update-rc.d dtgbot remove      #Remove previous version
sudo update-rc.d dtgbot defaults    #Install new version
Thanks.

It's really nice and easy to use.

One question regarding sharing the bot.
If I have a bot and I want to share with my son, but I don't want him to get all the notifications of what I'm doing (mosto probably he will remove it...), is there a way to do it or to have him get another bot connected with dtgbot?

User avatar
jvdz
Posts: 1062
Joined: Tuesday 30 December 2014 20:25
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Westland/Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by jvdz » Wednesday 27 April 2016 15:49

The bot part can be used by multiple people and make sure you put those id's in the Domoticz variable: TelegramBotWhiteListedIDs
This will ensure only those individuals will be able to update Domoticz. When you leave this empty you allow every telegram user potentially to make use of your bot.

As to the notifications: You lost me there as the Bot part is not ablout notifications but rather getting online info or changing Switches/Scenes defined in the rooms/plans. Maybe you can elaborate on what you exactly mean?

Jos

woody4165
Posts: 499
Joined: Monday 14 March 2016 14:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by woody4165 » Wednesday 27 April 2016 16:09

Thanks Jos.
So if I understood well, any other person should have their own Apia key, but the chat Id of the bot I'm using, right?
Regarding the last part, I mean I don't want other to see all the commands and notification I get when submit a dtgbot command.

User avatar
jvdz
Posts: 1062
Joined: Tuesday 30 December 2014 20:25
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Westland/Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by jvdz » Wednesday 27 April 2016 16:23

The bot has one API key, but each individual has their own ChatId as described here: https://www.domoticz.com/wiki/Telegram_ ... ur_chat_id
Each chat_id will have their own isolated session with dtgbot & menu. Only devices using the same ChatId will see the total session you have with the bot.

Does that make it any clearer ? :)
Jos

woody4165
Posts: 499
Joined: Monday 14 March 2016 14:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by woody4165 » Wednesday 27 April 2016 16:53

More clear, thanks.
Only one more things.
Since in the DomoticzData.sh there is a variable "TelegramChatId" where I have put my ChatId, how it works with another person that has another ChatId?
Does it work because he is connected to the same Bot?

User avatar
jvdz
Posts: 1062
Joined: Tuesday 30 December 2014 20:25
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Westland/Netherlands
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by jvdz » Wednesday 27 April 2016 17:23

I don't know why the TelegramChatId environment variable is defined in DomoticzData.sh, and can't find it anywhere being used in the scripts. I still have the code in there from the example file and things are working fine for me. Maybe simonrg knows.
Just put your chatid in the Domoticz variable TelegramBotWhiteListedIDs and things should be fine and safe.

Jos

simonrg
Posts: 1055
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi
Domoticz version:
Location: North East England
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by simonrg » Thursday 28 April 2016 1:00

TelegramChatId environment variable is there as some people were using Bash scripts which refer to it.

The list of ids in the Domoticz variable TelegramBotWhiteListedIDs, are the ids to which dtgbot will respond to commands from, dtgbot will ignore commands from any other chat ids.

I haven't played with multiple chat ids, but the responses should be visible to anybody who is part of the same conversation, even if they are not whitelisted to issue command.
Raspberry Pi 2 B - [email protected] 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

woody4165
Posts: 499
Joined: Monday 14 March 2016 14:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: dtgbot - Domoticz TeleGram BOT

Post by woody4165 » Friday 29 April 2016 16:06

I see a lots of hits to api.telegram.org even if I have not used it during the day.

I'm using PiHole as local dns as ads blocking and it tells me all the hits done in my network on a daily basis.
At this moment, starting from midnight, I've got more than 1100 hits to api.telegram.org without using even one time Telegram to see or set anything.

What can be all these hits for?

Thanks

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests