Página 1 de 1

Notificaciones telegram mediante Node-RED

Publicado: Jue Dic 27, 2018 6:31 pm
por pedro
Imagen
- instalar en Node-RED node-red-contrib-home-assistant-websocket y node-red-contrib-telegrambot ( NODE-RED, manage palette, install)
- importar el flujo en Node-RED (copiar codigo, Node-RED, import clipboard, pegar):

Código: Seleccionar todo

[{"id":"9ce68a37.b5c18","type":"server-state-changed","z":"e7cd7cb.c8e3f8","name":"cambio estado rele","server":"","entityidfilter":"switch.","entityidfiltertype":"substring","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"x":130,"y":60,"wires":[["57f8d820.0d8928"]]},{"id":"57f8d820.0d8928","type":"change","z":"e7cd7cb.c8e3f8","name":"traductor estado","rules":[{"t":"change","p":"payload","pt":"msg","from":"on","fromt":"str","to":"encendida","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"off","fromt":"str","to":"apagada","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"unavailable","fromt":"str","to":"sin conexión","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":100,"wires":[["aaed62b1.f141f"]]},{"id":"aaed62b1.f141f","type":"function","z":"e7cd7cb.c8e3f8","name":"componer mensaje","func":"msg.payload = {chatId :XXXXXXXXXX, \n               type : 'message',\n              content : msg.data.new_state.attributes.friendly_name + \" \" +\n              msg.payload  }\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":100,"wires":[["f074a44c.13065"]]},{"id":"80b704fa.ddbf2","type":"server-state-changed","z":"e7cd7cb.c8e3f8","name":"cambio estado luz","server":"","entityidfilter":"light.","entityidfiltertype":"substring","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"x":130,"y":140,"wires":[["57f8d820.0d8928"]]},{"id":"f074a44c.13065","type":"telegram sender","z":"e7cd7cb.c8e3f8","name":"telegrambot","bot":"","x":770,"y":100,"wires":[[]]}]
Configurar el acceso a HA y a telegram.
Se necesitan tres valores:
1- access token de home assistant.
En home assistant, botón configurar usuario (arriba la izquierda, inicial del usuario), Tokens de acceso de larga duración. Crear uno y copiarlo.
2- Token del boot de telegram. Se obtiene al crear el boot de telegram
3- Telegram id. yo lo obtuve preguntando al boot IoTwithus.com escribiendo /myid

Doble click en el nodo "cambio estado rele", boton editar server, poner la url (http://localhost:8123) y el access token (1)
poner también el mismo server en "cambio estado luz"
doble click en el nodo "telegrambot", y configurar el acceso al boot (boot-name, token (2), y chatid (3)
doble click en el nodo "componer mensaje" y poner en chatId :XXXXXXXXXX el de nuestro chat (3)

Si todo va bien, en cada cambio de estado de cualquier luz o rele, lo notifica. por ejemplo: "luz salon encendida" o "luz salon apagada".

Re: Notificaciones telegram mediante Node-RED

Publicado: Lun Abr 12, 2021 10:10 am
por milor
Lo probaré a ver si puedo inportarlo! GRACIAS aunque me gustaría saber que nodo son así montarlo manualmente (aunque sea más fácil errar)

P.D: ¿Porque no se usa la integración que tiene? ¿No consumismos más CPU?

Re: Notificaciones telegram mediante Node-RED

Publicado: Jue Abr 25, 2024 12:40 pm
por sapnamathur
Delhi Escorts, is a well recognized service for its elegance of the outer form. It provides best Call Girls Service Delhi with passion. Nightlife is an emotional connection for many besides nature and stunning scenery beauties. While you're in Delhi and have never tried the nightlife, then you'd have missed a big part of Delhi entertainment.