Liturgical Colours on a Smart light with Home Assistant

A while ago I came up with an idea for a website which shows the current liturgical colour of the Church of England. The website has the catchy name of Liturgical Colour and is now publicly available at https://liturgical.uk/

I also added an API which allows anyone to query the data progammatically. This is available at https://api.liturgical.uk/today and returns output like:

{
  "colour": "purple",
  "colourcode": "#664fa6",
  "date": "2025-12-04",
  "ember": 0,
  "name": "John of Damascus",
  "prec": 3,
  "season": "Advent",
  "season_url": "https://en.wikipedia.org/wiki/Advent",
  "type": "Commemoration",
  "type_url": "https://en.wikipedia.org/wiki/Commemoration_(Anglicanism)",
  "url": "https://en.wikipedia.org/wiki/John_of_Damascus",
  "week": "Advent 1",
  "weekno": 1
}

Still not satisfied, I decided to work on a smart table lamp that would be able to show the current liturgical colour. I have no experience in electronics or embedded computing, so I decided to use off-the-shelf smart lights and Home Assistant (not that I’ve got any experience with those either).

At the time I made the purchase, the cheapest RGB smart light that claimed to be compatible with Home Assistant. It happened to be a Wiz model, but the brand shouldn’t matter, so long as it work with Home Assistant. These instructions should be sufficiently generic.

Home Assistant setup

This guide assumes you have already installed a basic instance of Home Assistant.

It also assumes you have followed the smart light manufacturer’s instructions to get the light set up in Home Assistant.

Liturgical API Integration

First we need to configure this as an Integration in Home Assistant, using the RESTful integration. Unfortunately this can only be configured using the config file configuration.yaml and not via the UI.

Copy this config chunk into your configuration.yaml verbatim. It will poll the Liturgical API hourly and various various pieces of information as “sensors”.

rest:
  - resource: https://api.liturgical.uk/today
    scan_interval: 3600
    sensor:
      - name: "Liturgical colour"
        value_template: "{{ value_json.colour }}"
        icon: "mdi:cross"
        unique_id: "liturgical_colour"
      - name: "Liturgical colour code"
        value_template: "{{ value_json.colourcode_rgbw|join(', ') }}"
        icon: "mdi:cross"
        unique_id: "liturgical_colour_code_rgbw"
      - name: "Ember day"
        value_template: "{{ value_json.ember }}"
        icon: "mdi:cross"
        unique_id: "liturgical_ember_day"
      - name: "Liturgical observation"
        value_template: "{% if value_json.name %}{{ value_json.type }} of {{ value_json.name }}{% endif %}"
        icon: "mdi:cross"
        unique_id: "liturgical_observation"
      - name: "Liturgical season"
        value_template: "{{ value_json.season }}"
        icon: "mdi:cross"
		unique_id: "liturgical_season"
      - name: "Liturgical week"
        value_template: "{{ value_json.week }}"
        icon: "mdi:cross"
        unique_id: "liturgical_week"

Restart your Home Assistant instance. You should now be able to see a section called Sensors with various pieces of information, which we will be able to use in some automation.

Automations

Now we need to create some Automations to take the output from the Liturgical API and use the information to set the colour on the lamp.

In theory, an RGBW lamp should be able to display pure white, but on the lamp I tested, setting RGBW mode to pure white actually yielded a weird peach colour. As a workaround, we will create one automation for all the “colour” days and a separate automation for the “white” days which uses colour temperature mode instead, to achieve a proper white.

Setting up Automations via the UI is a bit fiddly and requires a lot of clicking, so again we will define them in configuration.yaml. Add the following section to create your automations. Be sure to change references to light.wiz_rgbw_tunable_04370c to your own lamp. You can check this ID by browsing Entities in the UI.

automation liturgical:
  - alias: Liturgical colour on (colour days)
    description: Switch on lamp at sunrise in RGBW mode, if it is a non-white colour day
    triggers:
      - trigger: sun
        event: sunrise
        offset: 0
    conditions:
      - or:
          - condition: state
            entity_id: sensor.liturgical_colour
            state:
              - purple
          - condition: state
            entity_id: sensor.liturgical_colour
            state:
              - red
          - condition: state
            entity_id: sensor.liturgical_colour
            state:
              - green
          - condition: state
            entity_id: sensor.liturgical_colour
            state:
              - rose
    actions:
      - target:
          entity_id: light.wiz_rgbw_tunable_04370c
        action: light.turn_on
        data:
          rgbw_color: "{{ states('sensor.liturgical_colour_code_rgbw') }}"
    mode: single

  - alias: Liturgical colour on (white)
    description: Switch on lamp at sunrise in colour temperature mode, if it is a white day
    triggers:
      - trigger: sun
        event: sunrise
        offset: 0
    conditions:
      - condition: state
        entity_id: sensor.liturgical_colour
        state:
          - white
    actions:
      - action: light.turn_on
        metadata: {}
        data:
          color_temp_kelvin: 6000
        target:
          entity_id: light.wiz_rgbw_tunable_04370c
    mode: single

  - alias: Liturgical off
    description: Switch off lamp at 11pm
    triggers:
      - trigger: time
        at: "23:00:00"
        weekday:
          - mon
          - tue
          - wed
          - thu
          - fri
          - sat
          - sun
    conditions: []
    actions:
      - action: light.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: light.wiz_rgbw_tunable_04370c
    mode: single

The Automations UI should look similar to this, and you should now have a smart light that illuminates in daylight hours, showing the current liturgical colour.

Leave a comment