home-assistant-telegram-bot
v1.0.4
Published
home-assistant-telegram-bot ----------------
Downloads
11
Readme
home-assistant-telegram-bot
An easy to use framework to create an advanced Telegram chatbot for interaction with Home Assistant
npm install home-assistant-telegram-bot
var Bot = require('home-assistant-telegram-bot').Bot
var bot = new Bot({
token: '<telegram-bot-token>',
url: '<home-assistant-url>',
password: '<home-assistant-password>'
})
bot.on('Temperature', function(chat, hass) {
chat.send('The temperature is {{sensor.temperature.state}}C')
})
bot.on('Turn light on', function(chat, hass) {
hass.switch.light.turnOn()
chat.send('Ok')
})
bot.observeState('sensor.wind', function(state, hass) {
if (state > 10) {
bot.sendToAll('It`s windy ({{hass.sensor.wind.state}})')
}
})