How can I have 2 or 3 time-dependent thresholds, e.g. L_day / L_night known from environmental noise law?

I made a panel for our noise measurement. We are a Non Government Organisation, we copied project “Airrohr/DNMS”) for tracking of railroad noise.

Now I want to integrate a day threshold of

59 dB from 6:00 to 22:00 o’clock, then
49 dB from 22:00 to 6:00
based on the BImSchV Law in Germany and perhaps similar in whole EU.

So what I have in mind, is a threshold which is depending on measurement time and consisting of 2 horizontal lines (perhaps optionally connected with 2 vertical lines at the ends).

Need to say, I have only ~ 30 hrs experience in setting up Grafana and creating Dashboards and Panels. Never managed to integrate own mathematical functions like the also urgently needed

Delta =
FROM autogen railnoise WHERE node = esp8266-12345678 SELECT field (DNMS_noise_LA_max) mean()
FROM autogen railnoise WHERE node = esp8266-98765432 SELECT field (DNMS_noise_LA_max) mean()

A bit similar need exist for other noise sources “TA Lärm” in Germany, where we have 3 thresholds in 4 time ranges:

49 dB from 7:00 to 20:00 o’clock, then
44 dB from 20:00 to 22:00, then
34 dB from 22:00 to 6:00, finally
44 dB from 6:00 to 7:00
at all Mondays to Saturdays.
In addition, on all Sundays we have
49 dB from 9:00 to 13:00 o’clock, then
44 dB from 13:00 to 15:00, then again
49 dB from 15:00 to 20:00 o’clock,
44 dB from 20:00 to 22:00, then
34 dB from 22:00 to 6:00, and finally
44 dB from 6:00 to 9:00

Could you give me a guide how to achieve such thresholds?

My thoughts:

  1. I could write a function, returning the value on time input, but I’d need advice how to insert algorithmic functions like if( 6 < time <= 9 ) return 44;
  2. I could insert such values into a InfluxDB for a fake week (week 1 of Jan/1st/1980 f.i.) but need to know how to “bend” this sample week into my current time scale
  3. I could preset the upcoming year in InfluxDB with such values by some C code or Pearl, if someone guides me into a data base crash course (am an low level coder, never used data base APIs).
  4. or in very worst case, I could hack this values somehow into the InfluxDB shell interface for every upcoming day of next year. I expect some easy to learn SQL statements like “for time in (6:00:00 to 8:59:59) step 60s set TH=44”

Could anybody give me please a direction or good entry point?

Many thanks for reading up to here!
More thanks for your thoughts!

okay, perhaps a picture is saying more than 1000 words.
Please watch the red line (Painted manually) raising by 10 dB at 6:00 and lowering at 22:00.
This is, what I need to achieve.

Any clues for a Grafana beginner?
Thank you, merci, gracias and Danke!