Skip to content

Instantly share code, notes, and snippets.

@Didgeridrew
Last active November 8, 2022 10:28
Show Gist options
  • Select an option

  • Save Didgeridrew/a3481d621432ffd48aa9e6cea0bad87c to your computer and use it in GitHub Desktop.

Select an option

Save Didgeridrew/a3481d621432ffd48aa9e6cea0bad87c to your computer and use it in GitHub Desktop.
HA: Spanish Word of the Day from RSS feed
#####################################################################
# This sensor relies on the feedparser custom component:
# https://github.com/custom-components/feedparser
#####################################################################
sensor:
- platform: feedparser
name: Free Dictionary Spanish WOD
feed_url: "https://es.thefreedictionary.com/_/WoD/rss.aspx?type=es_wod"
scan_interval:
hours: 12
inclusions:
- title
- link
- summary
exclusions:
- title_detail
- id
- links
- guidislink
- summary_detail
show_topn: 1
template:
- sensor:
- name: "Palabra del Dia"
state: >
{% set obj = state_attr('sensor.free_dictionary_spanish_wod', 'entries')[0] %}
{{ obj.title }}
attributes:
definition: >
{% set obj = state_attr('sensor.free_dictionary_spanish_wod', 'entries')[0] %}
{{ (((obj.summary).rsplit('<br />')[0])
.replace('Definición: ', '')).rsplit(') ')[1]
.replace('&#237;', 'í')
.replace('&#225;', 'á')
.replace('&#243;', 'ó')
.replace('&#233;', 'é')
.replace('&#250;', 'ú')
.replace('&#241;', 'ñ')
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment