Extra attributes to time and date component

I use home assistant to set heating profiles and use a time and date sensor to trigger the heat profile at the appropriate time. I would like to trigger some of the profiles based on day of the week, whether it was a weekend etc. and am currently doing this by some hackery.

Would it be possible to add the following attributes to time and date sensor:

  • Day of the week
  • whether it is a weekday or weekend
  • whether it is a public holiday (appreciate this one might not be possible)
  • date

Hey @timstanley1985, i think this could be possible with the time conditions.

an maybe the holidays with:

Greets
Rainer

Here are some of my examples where I use days…

https://github.com/CCOSTAN/Home-AssistantConfig/blob/master/automation/Speech/responsibilities.yaml#L21-L22

https://github.com/CCOSTAN/Home-AssistantConfig/blob/master/automation/good_morning.yaml#L26-L32

Don’t know if this helps, but Google calendar contains public holidays based on your location.

I should probably describe my use case a bit better. I currently have 8 heat profiles which are customisable through the front end, I have pasted a photo below.

I use the automation below to activate the heating profile:

  • alias: Heat Profile 1
    trigger:
    • platform: template
      value_template: ‘{%if states.input_select.heating_timer_1_time.state == states.sensor.time.state %} true {% endif %}’
      condition:
    • condition: state
      entity_id: input_boolean.heating_timer_1_switch
      state: ‘on’
    • condition: state
      entity_id: group.overrides
      state: ‘off’
    • condition: or
      conditions:
      • condition: template
        value_template: ‘{{ is_state(“input_boolean.heating_timer_1_weekday”, “on”) and is_state(“binary_sensor.weekday”, “on”) }}’
      • condition: template
        value_template: ‘{{ is_state(“input_boolean.heating_timer_1_weekend”, “on”) and is_state(“binary_sensor.weekday”, “off”) }}’
        action:
        service: script.turn_on
        data_template:
        entity_id: script.heating_{{ states.input_select.heating_timer_1_profile.state }}

As you can see in the condition section I have had to create an input_select which sets what day of the week it is and a binary_sensor which is a template that works out if it is a weekday or not. I then have an automation that runs at midnight each night and changes the day of the day of the week inout_select. I hope you now see why it feels so hacky. I would rather the condition just check an attribute in time and date to check whether the day of the week matched.

This is agreat share

Is indentation of the YAML correct?

Also would you share script.heating?

I am mainly interested in how to activate/ deactivate automations.