This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.

Add a way to cummunicate with a Telegram Bot

13468912

Comments

  • VonkenboerVonkenboer Member
    edited October 2016
    @jorden

    I did some testing with a old Panasonic BL-131 IP-Cam connected to a DockerDSM configuration with Surveillance Station installed . When sending /snap I get:
    /snap 1 (BL-131)
    /snap undefined (undefined)
    /snap 1 (BL-131)
    /snap 1 (BL-131)
    /snap 1 (BL-131)
    /snap 1 (BL-131)
    /snap 1 (BL-131)
    Cancel
    to choose from. when selecting one of the snap 1 (BL-131) it's sending me 4 to 6 snapshots (varies).
    Looks a bit strange to me.... ;)

    EDIT: FYI, when taking a snapshot by your Surveillance Station App triggered by a flow, only one snapshot is stored in Synology's Surveillance Station.
    EDIT 2: FYI, a user made in the Synology Surveillance Station is not used in any way. Looks like the user management in Surveillance Station is not used at all.
    EDIT 3: After a Homey restart it is functioning as intended. Looks like adding and deleting the Synology Surveillance device in the Homey Devices screen is the source of the strange behavior. 
    EDIT 4: FYI, encrypted communications is not working.
    EDIT 5: FYI, my conclusion in edit 3 is reproducible.
  • 1) That's odd! But it's just the way it works I guess
    2) Just the user in the "main" user list is required. Because the API does all the work.
    3) The Telegram app uses the Synology app to get a list of devices *in Homey*. It does not check the Synology itself
    4) All communications between Telegram and Athom/Homey are encrypted. Not sure which encrypted communications you are talking about?

    About the /ask: 
    On Telegram, you can type "/ask how are you today, sir" and Homey should then say: "How are you today, sir" and wait for a confirmation. Then it will send out whatever Homey heard to your Telegram app. However, as mentioned before, it seems like it's not fully working yet, so I'll have another look at it soon.
  • VonkenboerVonkenboer Member
    edited October 2016
    Thank you for responding, @jorden. Maybe I'm not really clear what I meant, sorry for that.

    1: I did some tests and noticed some strange behaviour when adding/deleting a IP-CAM (Homey devices-screen) from your Surveillance Station App:
    - When adding a cam the first time it looks ok.
    - When deleting the cam and readding the device, with the same Synology user credentials, I got the strange behaviour in your Telegram app.
    - Rebooting the Homey solves the strange behaviour (until deleting and re-adding cams again).

    2: The encryption is not working, well I couldn't get it working, in your Surveillance Station App. Meaning, I cannot get it to work communicating to the Synology NAS https-port (using port 5001 instead of port 5000).

    3: The point I want to make about the user management. Because the communications between your Surveillance Station app and the Synology NAS is unencrypted, and uses a Synology admin-group user account, it has severe potential security vulnerability to the Synology NAS.
    As mentioned before, I did some test, more then year ago, communicating from my Fibaro HC ZWave gateway and was able to use the Surveillance Station management-user. This way you prevent, when compromised, potential  very harmful access to the Synology!
    The original apps build by Synology are using this setup (to my knowledge) and code made by Fibaro users also.

    Let me be clear, the points I want to make is to not to criticize your excellent piece of work, just suggestions (IMHO) to improve it.....

    4: EDIT: FYI, minor glitch detected. When text contains an asterisk (*) to send to Telegram, triggered by a flow, the message is not send at all.
  • OGSOGS Member
    @jorden ;
    I have the strange situation that my Homey is now linked to two telegram chats. 
    I created my own bot following your steps and get messages from Homey on it but I have to send messages to the Homeybot to get them to my Homey. 
    Do you know where I went wrong?
  • OGS said:
    @jorden ;
    I have the strange situation that my Homey is now linked to two telegram chats. 
    I created my own bot following your steps and get messages from Homey on it but I have to send messages to the Homeybot to get them to my Homey. 
    Do you know where I went wrong?
    Hmm I have the same problem, I can get a message to Homey neither. Had to register my account thru  @athomhomey_bot and recieved a message on my own bot that it was succesfull

  • Looks to me it's not properly unregistered?

    Did you used the Settings --> Telegram Bot --> unregister instruction (/unregister **********)
    Your Telegram Bot: /unregister **********
  • Yes, I even made a new bot. The old one didnt work, (installed synology today and tryed snap function), the new bot doesnt respond also.
  • VonkenboerVonkenboer Member
    edited December 2016
    Hmm. Did some investigation how the Telegram protocol works. Maybe you can do something with it?

    - First get your <Token> from your Telegram Bot by getting it with your Telegram client by ask BotFather /mybots
    - Select API Token
    Copy the TOKEN

    - Check your Telegram Bot webhook settings by open a url in your webbrowser:
    https://api.telegram.org/botTOKEN/getWebhookInfo
    - If it is linked to Homey by webhook it should return something like:
    {"ok": true,"result": {"url": "https://webhooks.athom.com/webhook/*****************","has_custom_certificate": false,"pending_update_count": 0,"max_connections": 40}}

    Use at own risk:
    As I get the info right the webhook could be remove by sending a setWebhook with a empty url:
    https://api.telegram.org/botTOKEN/setWebhook
    or something like:
    https://api.telegram.org/botTOKEN/setWebhook?url=''

    I didn't test the above step to remove Webhook because it removes my existing Telegram App Webhook settings, so use it at your own risk!!
    I don't know what this is doing inside the Telegram App, we need @jorden to comment on this.

    I just sharing what I found on https://core.telegram.org/bots/api

    EDIT: Changed some text to be more clear, the forum software messed up my links....

  •  :) works again including /snap 
  • 0burner0 said:
     :) works again including /snap 
    Can you share how you solved your problem?
  • @jorden Is this app still under development or did you abandon?  ;)
  • 0burner0 said:
     :) works again including /snap 
    Can you share how you solved your problem?
    I didnt do anything, the update fixed my problem.
    I created my own bot what is explained in the faq

  • @Vonkenboer still under development, but I'm just really busy at work and in my personal life, so currently no development at all.
  • jorden said:
    @Vonkenboer still under development, but I'm just really busy at work and in my personal life, so currently no development at all.
    Okay, clear. Succes on handling your work/private pursuits, which's always far more important!
  • Is it possible that my partner can also receive de telegram messages ?
    Its now send to a bot in Homey but only to me, is this possible?
  • hvhol said:
    Is it possible that my partner can also receive de telegram messages ?
    Its now send to a bot in Homey but only to me, is this possible?
    Check https://forum.athom.com/discussion/comment/27606/#Comment_27606 ;)

  • jorden said:
    After a lot of trying, I got something cool working....

    how dit you do this.

    i have a foscam webcam and wanna sent a pic to telegram

  • @goldstrike you need a Synology NAS and need to hook up the camera to Synology Surveillance station. Then install the Synology Surveillance Station app to Homey -> https://apps.athom.com/app/com.synology.surveillance

    Then install the Telegram app on your phone/desktop, as well as on your Homey, connect the app to the bot as instructed in the Homey app, and then you can send "/snap" to get available options.
  • jorden said:
    @goldstrike you need a Synology NAS and need to hook up the camera to Synology Surveillance station. Then install the Synology Surveillance Station app to Homey -> https://apps.athom.com/app/com.synology.surveillance

    Then install the Telegram app on your phone/desktop, as well as on your Homey, connect the app to the bot as instructed in the Homey app, and then you can send "/snap" to get available options.

    is there a option without the synology serveillance station ?


  • No, not currently. The "native" webcam support in Homey will still take a long time, I think.
  • jorden said:
    No, not currently. The "native" webcam support in Homey will still take a long time, I think.

    i made a php page thet capturs the video sream and takes a snapshot. the snepshot is sent to my telegram bot fore nou

    al all will be started by a trigger en the trigger wil send it by http get

  • Yeah that's the way I made it before I made the Synology app :)
  • jorden said:
    No, not currently. The "native" webcam support in Homey will still take a long time, I think.

    i made a php page thet capturs the video sream and takes a snapshot. the snepshot is sent to my telegram bot fore nou

    al all will be started by a trigger en the trigger wil send it by http get


    could you explain some more, for me and those who don have aa synology.. :)


  • goldstrikegoldstrike Member
    edited February 2017
    jorden said:
    No, not currently. The "native" webcam support in Homey will still take a long time, I think.

    i made a php page thet capturs the video sream and takes a snapshot. the snepshot is sent to my telegram bot fore nou

    al all will be started by a trigger en the trigger wil send it by http get


    could you explain some more, for me and those who don have aa synology.. :)



    yes i can. whare can i post the php scipts.
    i have made it more intresting nou i capture a small video 10sec en it plays on telegram as a gif

    you nead a webserver to do this

  • Hey guys,

    Two questions w.r.t. what's coming up:

    1. Is it in the plans to be able to send messages to a groupID instead? I think this is the easiest way to send a message to multiple users.
    2. Will the "snap" function eventually be integrated into the flows? Basically, for example, I would like Homey to send me a snapshot from the camera via telegram when ever the doorbell is pressed for example.
  • 1. I think this shouldn't be too hard, however it will take some time before I can implement this.
    2. I'm not sure if that will be working well. I would have to change the Synology function that makes a screen to make it "enable" triggers, then make a trigger with a token that  is huge and I'm not sure if Homey can cope with that. Will have to discuss that with Athom. And then finally I would have to make a detection to make sure that the image token is recognized as an image and processed properly. That's a lot of work which means a lot of time to create and test, which means it will have to wait for a while because I'm quite busy at the moment.
  • Update 0.1.5 coming up soon (submitted to the app store for approval).

    It contains a new "Send image" action card that allows you to drop an "Image token" into it. That image token can be generated by the new Synology app (coming up soon, also submitted for approval) or Doorbird app (not yet tested).
  • @Veldkornet you will love this update that is coming up soon (your point 2).

    Point 1 I will still have to take a look at.
  • You sir, rock!
  • LOL thanks senor, your comment makes my day ;)
Sign In or Register to comment.