Squash Court Lifghting automation

Hi All

I have been asked to look into automating the lighting for the Squash courts at the club I play for, and home assistant came to mind.

I have used HA in the past so I can find my way around but I’m not a expert, nor am I a programmer, although I can read the yaml code and kinda figure out what it does.

This is the Scenario:

They are using an external online booking system for booking of the courts, The online booking company have said that they will give us an API to pull the info from.
The booking slots are currently 45mins each ( this is going to change for automation purposes and so people are not running into each others paid for lighting sessions )

I have 2 ideas and I don’t know which is the better option or how to do this.

First idea

  1. Booking slot change to 50mins
  2. Call the API every 5mins and if there is a booking in that slot then run an automation direct from home assistant, This will turn that specific courts lights on for 45mins, then turn lights off for 5 seconds indicating your time slot is actually up, Then turn back on for 3 mins to finish up the last point or 2. Then off for 2 mins to give the next person time to get on the court and wait for their time slot to start, should there be a booking directly after one.

Thought 2

Build a pc/server and create “middleware” to read from the online booking API and if there is a booking send a command to the home assistant API to trigger the automation.

I am not a programmer by any means and will have assistance from somebody but if there is a simple way to do this all from home assistant and you can shed some light that would be great.

Just an update on this using the HA API and webhooks I am able to run the automation for the lights. Next step is to find out how to do this from the other software that we will be using to pull the booking info from