| 
									
										
										
										
											2018-01-01 19:00:45 -05:00
										 |  |  | ###############################################################################
 | 
					
						
							| 
									
										
										
										
											2019-02-22 14:55:09 -05:00
										 |  |  | #-------------------------------------------
 | 
					
						
							|  |  |  | # Holiday Package
 | 
					
						
							|  |  |  | # @CCOSTAN
 | 
					
						
							|  |  |  | # Repo : https://github.com/CCOSTAN/Home-AssistantConfig
 | 
					
						
							|  |  |  | # Video Breakdown - https://www.vcloudinfo.com/2019/02/breaking-down-the-flag-sensor-in-home-assistant.html
 | 
					
						
							|  |  |  | #-------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2018-01-01 19:00:45 -05:00
										 |  |  | ## Modified for my own fun stuff!
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | homeassistant:
 | 
					
						
							|  |  |  |   customize:
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     sensor.holiday:
 | 
					
						
							| 
									
										
										
										
											2021-07-26 16:16:49 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-01 19:00:45 -05:00
										 |  |  |       icon: mdi:beach
 | 
					
						
							|  |  |  |       friendly_name: US Holiday
 | 
					
						
							|  |  |  |     sensor.flag:
 | 
					
						
							| 
									
										
										
										
											2021-07-26 16:16:49 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-01 19:00:45 -05:00
										 |  |  |       icon: mdi:flag
 | 
					
						
							|  |  |  |       friendly_name: Flag Day
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ###############################################################################
 | 
					
						
							|  |  |  | # Sensor updates once every 4 hours (14400 seconds) & runs 6 times in 24 hours
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | # First it checks for holiday in static section, if that doesn't exist,
 | 
					
						
							|  |  |  | # it checks in the dynamic section. If neither exists, the value will be empty
 | 
					
						
							|  |  |  | ###############################################################################
 | 
					
						
							|  |  |  | sensor:
 | 
					
						
							|  |  |  |   - platform: rest
 | 
					
						
							| 
									
										
										
										
											2018-02-28 20:00:44 -05:00
										 |  |  |     resource: https://raw.githubusercontent.com/CCOSTAN/Home-AssistantConfig/master/config/json_data/holidays.json
 | 
					
						
							| 
									
										
										
										
											2018-01-01 19:00:45 -05:00
										 |  |  |     name: Holiday
 | 
					
						
							|  |  |  |     scan_interval: 14400
 | 
					
						
							|  |  |  |     value_template: >
 | 
					
						
							|  |  |  |       {% set today = now().month  ~ '/' ~ now().day  %}
 | 
					
						
							|  |  |  |       {% set holiday =  value_json.MAJOR_US.static[ today ] %}
 | 
					
						
							|  |  |  |       {% if holiday | trim == "" %}
 | 
					
						
							|  |  |  |         {% set today = now().month  ~ '/' ~ now().day ~ '/' ~ now().year %}
 | 
					
						
							|  |  |  |         {% set holiday =  value_json.MAJOR_US.dynamic[ today ] %}
 | 
					
						
							|  |  |  |       {% endif %}
 | 
					
						
							|  |  |  |       {{ holiday }}
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-22 14:55:09 -05:00
										 |  |  | ################################################################################
 | 
					
						
							|  |  |  | # Sensor Uses Flag data from this calendar - http://www.webcal.fi/en-US/flag_days.php
 | 
					
						
							|  |  |  | ################################################################################
 | 
					
						
							| 
									
										
										
										
											2019-01-10 15:32:07 -05:00
										 |  |  |   - platform: rest
 | 
					
						
							| 
									
										
										
										
											2019-10-10 00:39:10 -04:00
										 |  |  |     resource: https://www.webcal.fi/cal.php?id=335&format=json&start_year=current_year&end_year=current_year&tz=America%2FNew_York
 | 
					
						
							| 
									
										
										
										
											2019-01-10 15:32:07 -05:00
										 |  |  |     name: Flag
 | 
					
						
							|  |  |  |     scan_interval: 14400
 | 
					
						
							|  |  |  |     value_template: >-
 | 
					
						
							|  |  |  |       {%- set now_string = now().strftime('%Y-%m-%d') %}
 | 
					
						
							|  |  |  |       {% for day_val in value_json if day_val.date == now_string  %}
 | 
					
						
							|  |  |  |         True
 | 
					
						
							|  |  |  |         {% else %}
 | 
					
						
							|  |  |  |         False
 | 
					
						
							|  |  |  |       {% endfor -%}
 | 
					
						
							| 
									
										
										
										
											2018-01-01 19:00:45 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-06 14:00:44 -04:00
										 |  |  | ################################################################################
 | 
					
						
							| 
									
										
										
										
											2023-11-18 18:29:27 +00:00
										 |  |  | # Countdown Sensor using WolfRam Alpha Natural language queries
 | 
					
						
							| 
									
										
										
										
											2019-10-06 14:00:44 -04:00
										 |  |  | ################################################################################
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-21 18:17:21 -04:00
										 |  |  |   - platform: rest
 | 
					
						
							| 
									
										
										
										
											2019-10-06 14:00:44 -04:00
										 |  |  |     name: Halloween Countdown
 | 
					
						
							| 
									
										
										
										
											2019-10-21 18:17:21 -04:00
										 |  |  |     resource: !secret wolframalpha_halloween_api
 | 
					
						
							|  |  |  |     value_template: "{{ (value|replace(' days', '')) | int }}"
 | 
					
						
							| 
									
										
										
										
											2019-10-06 14:00:44 -04:00
										 |  |  |     unit_of_measurement: Days
 | 
					
						
							|  |  |  |     scan_interval: 43200
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-21 18:17:21 -04:00
										 |  |  |   - platform: rest
 | 
					
						
							| 
									
										
										
										
											2019-11-15 19:16:23 -05:00
										 |  |  |     name: Christmas Countdown
 | 
					
						
							| 
									
										
										
										
											2019-10-21 18:17:21 -04:00
										 |  |  |     resource: !secret wolframalpha_xmas_api
 | 
					
						
							|  |  |  |     value_template: "{{ (value|replace(' days', '')) | int }}"
 | 
					
						
							|  |  |  |     unit_of_measurement: Days
 | 
					
						
							| 
									
										
										
										
											2019-10-06 14:00:44 -04:00
										 |  |  |     scan_interval: 43200
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   - platform: rest
 | 
					
						
							|  |  |  |     name: Easter Countdown
 | 
					
						
							|  |  |  |     resource: !secret wolframalpha_easter_api
 | 
					
						
							|  |  |  |     value_template: "{{ (value|replace(' days', '')) | int }}"
 | 
					
						
							|  |  |  |     unit_of_measurement: Days
 | 
					
						
							|  |  |  |     scan_interval: 43200
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   - platform: rest
 | 
					
						
							| 
									
										
										
										
											2020-04-07 14:12:13 -04:00
										 |  |  |     name: Mothers Countdown
 | 
					
						
							| 
									
										
										
										
											2019-10-06 14:00:44 -04:00
										 |  |  |     resource: !secret wolframalpha_mothersday_api
 | 
					
						
							|  |  |  |     value_template: "{{ (value|replace(' days', '')) | int }}"
 | 
					
						
							| 
									
										
										
										
											2019-10-06 14:18:00 -04:00
										 |  |  |     unit_of_measurement: Days
 | 
					
						
							|  |  |  |     scan_interval: 43200
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   - platform: rest
 | 
					
						
							| 
									
										
										
										
											2020-04-07 14:12:13 -04:00
										 |  |  |     name: Fathers Countdown
 | 
					
						
							| 
									
										
										
										
											2019-10-06 14:18:00 -04:00
										 |  |  |     resource: !secret wolframalpha_fathersday_api
 | 
					
						
							|  |  |  |     value_template: "{{ (value|replace(' days', '')) | int }}"
 | 
					
						
							| 
									
										
										
										
											2019-10-21 17:33:31 -04:00
										 |  |  |     unit_of_measurement: Days
 | 
					
						
							|  |  |  |     scan_interval: 43200
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   - platform: rest
 | 
					
						
							|  |  |  |     name: Chanukkah Countdown
 | 
					
						
							|  |  |  |     resource: !secret wolframalpha_chanukkah_api
 | 
					
						
							|  |  |  |     value_template: "{{ (value|replace(' days', '')) | int }}"
 | 
					
						
							| 
									
										
										
										
											2019-10-06 14:00:44 -04:00
										 |  |  |     unit_of_measurement: Days
 | 
					
						
							|  |  |  |     scan_interval: 43200
 | 
					
						
							| 
									
										
										
										
											2020-02-15 18:52:58 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |   - platform: rest
 | 
					
						
							|  |  |  |     name: Labor Day Countdown
 | 
					
						
							|  |  |  |     resource: !secret wolframalpha_labor_api
 | 
					
						
							|  |  |  |     value_template: "{{ (value|replace(' days', '')) | int }}"
 | 
					
						
							|  |  |  |     unit_of_measurement: Days
 | 
					
						
							|  |  |  |     scan_interval: 43200
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   - platform: rest
 | 
					
						
							|  |  |  |     name: Memorial Day Countdown
 | 
					
						
							|  |  |  |     resource: !secret wolframalpha_memorial_api
 | 
					
						
							|  |  |  |     value_template: "{{ (value|replace(' days', '')) | int }}"
 | 
					
						
							|  |  |  |     unit_of_measurement: Days
 | 
					
						
							|  |  |  |     scan_interval: 43200
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   - platform: rest
 | 
					
						
							|  |  |  |     name: Thanksgiving Day Countdown
 | 
					
						
							|  |  |  |     resource: !secret wolframalpha_thanksgiving_api
 | 
					
						
							|  |  |  |     value_template: "{{ (value|replace(' days', '')) | int }}"
 | 
					
						
							|  |  |  |     unit_of_measurement: Days
 | 
					
						
							|  |  |  |     scan_interval: 43200
 |