Skip to content

Instantly share code, notes, and snippets.

@Kagee
Created February 29, 2020 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kagee/bdbc89d0c548116bbccab835bf6e810a to your computer and use it in GitHub Desktop.
Save Kagee/bdbc89d0c548116bbccab835bf6e810a to your computer and use it in GitHub Desktop.
ii -s irc.homelien.no -n botname -i ./irc
echo "/join #some_channel" > irc/irc.homelien.no/in
tail -n 0 -f irc/irc.homelien.no/#some_channel/out | stdbuf -oL -eL grep -v -- '-!-' | sed -u -r -e 's/(")//g' -e "s/(')//g" -e 's/.*<([^>]*)>\s(.*)/{ "nick":"\1", "msg":"\2" }/' | while read D; do echo "$D"; curl
--header "Content-Type: application/json" --request POST --data "$D" https://home-assistant:8123/api/webhook/irc_tts; done
home-assistant/config/automations.yaml:
- id: 'irc-tts'
alias: Talking irc
description: 'Talking #irc (desc)'
trigger:
- platform: webhook
webhook_id: irc_tts
action:
- service: tts.google_cloud_say_no
data:
entity_id: media_player.livingroom
data_template:
message: >
{{ trigger.json.nick }} sa {{ trigger.json.msg }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment