grover / homebridge-telegram

HomeKit/Homebridge driven notifications via Telegram
MIT License
46 stars 5 forks source link

Example config on npmjs buggy #10

Open sschuste opened 5 years ago

sschuste commented 5 years ago

Not a code issue, but your example config on https://www.npmjs.com/package/homebridge-telegram is buggy and differs from the one shown here on GitHub.

Stefan

Kjoffy commented 4 years ago

Here, use this one attached

Config (1).txt

jeylites commented 4 years ago

Can't seem to get this working on IOS 13, Homebridge & plugin load successfully and I see an icon on Homekit app but it says Not Supported. What could be the issue? Is it a config issue?

Hardware: Raspberry Pi 3B+ Homebridge: Alpine Docker Setup

{
    "bridge": {
        "name": "Home2#7",
        "username": "",
        "port": 52332,
        "pin": "031-45-150"
    },
    "accessories": [],
    "platforms": [
        {
            "platform": "Telegram",
            "bots": [
                {
                    "name": "Bot name as seen in HomeKit",
                    "token": "1039561798:AAGGJwwTqi5JJYLlbrHSO7rvDVTqZmnNB2E",
                    "chat": "-358641562",
                    "error": "Something broken. I'm shutting down.",
                    "notifications": {
                        "Hello": {
                            "mode": "Markdown",
                            "randomize": true,
                            "messages": [
                                "*Hi!*",
                                "_Hello!_",
                                "Hey mate!",
                                {
                                    "bye": {
                                        "mode": "HTML",
                                        "randomize": false,
                                        "messages": [
                                            "<b>Good bye!</b>",
                                            "<i>I'm sad to see you leave.</i>"
                                        ]
                                    }
                                }
                            ]
                        }
                    }
                }
            ]
        }
    ]
}
roboterm commented 4 years ago

Status „Not Supported“ is normal. But your chat id looks wired. Didn’t know that there are negative ids.

roboterm commented 4 years ago

And your config looks wired too. Take a look at mine:

 {
    "platform" : "Telegram"    
    "name" : "R0bot",  
    "bots" : [  
        {
            "chat" : "15683609",  
            "token" : "xxxxxxxxxx",  
            "name" : "R0bot",  
            "error" : "Something broken. I'm shutting down.",  
            "notifications" : {  
                "Auf Wiedersehen" : {  
                    "mode" : "HTML",  
                    "randomize" : false,  
                    "messages" : [  
                        "<b>Letzte Person hat Wohnung verlassen.</b>"  
                    ]  
                },  
                "Air Alert" : {  
                    "mode" : "HTML",  
                    "randomize" : false,  
                    "messages" : [  
                        "<b>Air Alert!</b>"  
                    ]  
                },  
                "Sonnenaufgang" : {  
                    "mode" : "HTML",  
                    "randomize" : false,  
                    "messages" : [  
                        "<b>Sonnenaufgang</b>"  
                    ]  
                },  
                "Willkommen" : {  
                    "mode" : "HTML",  
                    "randomize" : false,  
                    "messages" : [  
                        "<b>Willkommen!</b>"  
                    ]  
                },  
                "Sonnenuntergang" : {  
                    "mode" : "HTML",  
                    "randomize" : false,  
                    "messages" : [  
                        "<b>Sonnenuntergang</b>"  
                    ]  
                }  
            }  
        }  
    ],  
},  
Kjoffy commented 4 years ago

Hi Guys,

If the chat is a group, then the Chat ID will be negative. If it is about a single person, then it will be positive.

I believe you should send the notifications to the single user added to the group chat.

jeylites commented 4 years ago

@roboterm @Kjoffy

Thanks, guys for taking the time to write back, the sample config Robert provided helped. The sample config on wiki needs to be updated as it doesn't work.

I learned about chat ID "-" while watching a Youtube video on How to Create a Telegram Bot and Send Message via bot API.

If anyone runs into the same issue, check the above link out.

Here is my working config

{
    "bridge": {
        "name": "Home2#7",
        "username": "0E:B3:82:CB:2F:D4",
        "port": 52332,
        "pin": "031-45-150"
    },
    "accessories": [],
    "platforms": [
        {
            "platform": "Telegram",
            "bots": [
                {
                    "name": "SMILE ALERTS",
                    "token": "10395617900000000JJYLlbrHSO7rvDVTqZmnNB2",
                    "chat": "-358641562",
                    "error": "Something broken. I'm shutting down.",
                    "notifications": {
                        "FED THE CAT": {
                            "mode": "HTML",
                            "randomize": false,
                            "messages": [
                                "FED THE CAT!"
                            ]
                        },
                        "AUTO GATE OPEN": {
                            "mode": "HTML",
                            "randomize": false,
                            "messages": [
                                "AUTO GATE OPEN"
                            ]
                        }
                    }
                }
            ]
        }
    ]
}
jeylites commented 4 years ago

BTW, there seems to be a bug with the plugin. When one tries to turn off "include in Favorites" it still shows up on the Homekit - Favorite list.

Tried to simulate the same for other plugins, no issue.

Updated

FIX: Click on Edit - top right corner of the Homekit app, the icon will start to wiggle. Click on the Plugin Icon and slide to turn off the "include in Favorites" option.