Toon app: ToonBot

Forum about forum-provided applications on Toon

Moderators: marcelr, TerrorSource, Toonz, TheHogNL

Toon app: ToonBot

Postby glsf91 » Sat Mar 21, 2020 4:17 pm

I have made an app to remote control the Toon with Telegram. It has the following functionality:

This app is a Telegram Bot. With this app you are able to get the following information from the Toon on Telegram:
- current measured temperature
- current thermostat temperature
- current active program
- program state (on/off/temporary)
- next program

With some commands you can also change the following:
- thermostat temperature
- program
- program state (on/off)

When a random character is sent from Telegram, it returns a message with the possible commands. The app will poll Telegram with a configurable interval. So a respons from Toon will arrive after this interval.
On the Tile it shows:
- name and username of the bot
- last received command
- status

When clicking on the Tile you get a screen with the last received commands. But when a token is not defined you get a popup about this token.
There is also a refresh button to trigger a manual update from Telegram. Use this also when the status is showing an error on the Tile. It will trigger getting the updates again.

You can change the following settings:
- token of Telgram bot (it won't work without; instructions are on the page)
- refresh interval (interval in seconds to get new message from Telegram)
- refresh of messages on/off (switch off receiving messages from Telegram)
- icon in systray

(if you don't like adding the token by the keyboard you can save the configuration one time and add the token by login on the Toon and add the token in /mnt/data/tsc/toonbot.userSettings.json)

Before you can use this app, you have to create a Telegram Bot first. It is very easy to create a bot. See instructions on the configuration screen (or here https://core.telegram.org/bots#6-botfather ).
You can also control the Toon with more people from a Telegram group. Just add the Bot to a group.

If you change the display name of your bot (with BotFarther) it will be visible after restart of Toon GUI (TSC menu).
If you choose a long username and display name when creating a bot, it will probably not fit on the Tile. Is is also visible on the screen after clicking in the Tile (or use the systray icon).
You can not change the username after creating the Bot (just create a new bot). You can only change the display name.

It is also possible to define the commands in your bot. Go to BotFather and give the command /setcommands.
Paste the following (and change it if needed) end Enter:
Code: Select all
info - Vraag Toon gegevens op
prog_c - Activeer programma Comfort
prog_t - Activeer programma Thuis
prog_w - Activeer programma Weg
prog_s - Activeer programma Slapen
auto_a - Zet auto programma aan
auto_u - Zet auto programma uit
therm_20 - Thermostaat op 20 graden


By type a "/" in Telegram you see the above commands and you can just click on them.

Example of Telegram messages:
telegram.PNG
telegram.PNG (196.43 KiB) Viewed 127 times


V1.0.0
Initial release

V1.0.1
- fixed last update time sometimes wrong
- fixed refresh after Telegram request failure

V1.0.2
- debug logging switched off by default

V1.1.0
- changed bot commands to make it possible to use the commands in /setcommands in BotFather

Known issues
Empty thumbnail icon when adding to Tile. Has no influence on app functionality. Is fixed when using firmware 5.25.8 or later.
Last edited by glsf91 on Fri Mar 27, 2020 10:00 pm, edited 6 times in total.
glsf91
Member
Member
 
Posts: 133
Joined: September 2017

Re: Toon app: ToonBot

Postby Toonz » Sat Mar 21, 2020 7:03 pm

App has been added to the ToonStore. Thanks glsf91 :-)
member of the Toon Software Collective
User avatar
Toonz
Forum Moderator
Forum Moderator
 
Posts: 1374
Joined: December 2016

Re: Toon app: ToonBot

Postby glsf91 » Sat Mar 21, 2020 7:13 pm

That is quick. Thank you.
glsf91
Member
Member
 
Posts: 133
Joined: September 2017

Re: Toon app: ToonBot

Postby Toonz » Sat Mar 21, 2020 9:30 pm

hee, it's not Quby here :-)
member of the Toon Software Collective
User avatar
Toonz
Forum Moderator
Forum Moderator
 
Posts: 1374
Joined: December 2016

Re: Toon app: ToonBot

Postby michel30 » Sat Mar 21, 2020 10:26 pm

Nice app good job.
michel30
Member
Member
 
Posts: 236
Joined: August 2017

Re: Toon app: ToonBot

Postby glsf91 » Sun Mar 22, 2020 1:30 pm

Added a new version 1.0.1.
- fixed last update time sometimes wrong
- fixed refresh after Telegram request failure
glsf91
Member
Member
 
Posts: 133
Joined: September 2017

Re: Toon app: ToonBot

Postby TheHogNL » Mon Mar 23, 2020 8:42 am

glsf91 wrote:Added a new version 1.0.1.
- fixed last update time sometimes wrong
- fixed refresh after Telegram request failure


Updated toonstore to have 1.0.1 in the repo. And published a new resource file (only) for the latest firmware so the toonbot icon is in the resource file
Member of the Toon Software Collective
User avatar
TheHogNL
Forum Moderator
Forum Moderator
 
Posts: 1415
Joined: August 2017

Re: Toon app: ToonBot

Postby TerrorSource » Thu Mar 26, 2020 10:42 pm

@glsf91, could you comment out the console.log lines in the next release?
found 82x in App.qml and 4x in Screen.qml, all active. So when someone (like me) had edited the inittab to collect logs a lot of logs are writen and the Toon doesn't like these amount of lines writen :)
TerrorSource
Member
Member
 
Posts: 356
Joined: May 2017

Re: Toon app: ToonBot

Postby RNdX » Fri Mar 27, 2020 10:05 am

Is it possible to create your own commands?
I try to edit my bot, for example:

/command1 - programma:thuis
/command2 - programma:weg

the benefits of it ones you type '/' u can choose your command by one simple click instead of typing commands.
RNdX
Starting Member
Starting Member
 
Posts: 6
Joined: December 2019

Re: Toon app: ToonBot

Postby glsf91 » Fri Mar 27, 2020 10:40 am

TerrorSource wrote:@glsf91, could you comment out the console.log lines in the next release?
found 82x in App.qml and 4x in Screen.qml, all active. So when someone (like me) had edited the inittab to collect logs a lot of logs are writen and the Toon doesn't like these amount of lines writen :)


I made a new version V1.0.2 where logging is switched off by default.
Last edited by glsf91 on Fri Mar 27, 2020 9:54 pm, edited 3 times in total.
glsf91
Member
Member
 
Posts: 133
Joined: September 2017

Re: Toon app: ToonBot

Postby glsf91 » Fri Mar 27, 2020 12:41 pm

RNdX wrote:Is it possible to create your own commands?
I try to edit my bot, for example:

/command1 - programma:thuis
/command2 - programma:weg

the benefits of it ones you type '/' u can choose your command by one simple click instead of typing commands.


It is not possible to use your own commands. In your example, "programma:thuis" is just a description. The bot does not receive the description. Only "/command1".

What I can do is make shorter commands and use '_' as a separator and then you can create your this command with your own description.

Example: If I make a shortcut "/prog_t" for programma:thuis then you can define the command "/prog_t - Change to program Thuis" and you can click the command.

For /thermostat I could shorten this to /therm_18 and /therm_185. Not sure if this will be clear enough for everyone.

edit:
I have made a new release v1.1.0 where the bot commands are changed.
Now it is possible to use /setcommands in BotFather to add the following for example:
Code: Select all
info - Vraag Toon gegevens op
prog_c - Activeer programma Comfort
prog_t - Activeer programma Thuis
prog_w - Activeer programma Weg
prog_s - Activeer programma Slapen
auto_a - Zet auto programma aan
auto_u - Zet auto programma uit
therm_20 - Thermostaat op 20 graden


By type a "/" in Telegram you see the above commands and just click on them.
Thanks to RNdX for the idea.
glsf91
Member
Member
 
Posts: 133
Joined: September 2017

Re: Toon app: ToonBot

Postby Toonz » Sat Mar 28, 2020 2:18 pm

Version 1.1.0 is available in ToonStore now.
member of the Toon Software Collective
User avatar
Toonz
Forum Moderator
Forum Moderator
 
Posts: 1374
Joined: December 2016


Return to Toon Apps

Who is online

Users browsing this forum: No registered users and 0 guests