For those of you in France on the EDF Tempo tariff, here is a dzVents script that keeps the Tempo colour in Domoticz and warns you when a red day is coming. In full transparency: calendrier-tempo.fr is an independent project I run, a free site (not affiliated with EDF or RTE), and the script uses its API. No account, no token, no API key.
What it does:
- 2 Alert sensors: today's and tomorrow's official colour (green = BLEU, yellow = BLANC, red = ROUGE, grey while tomorrow is not published yet)
- 1 Percentage sensor: probability of a red day at D+2 (forecast)
- 1 Custom sensor: red days left in the season
- A Domoticz notification (once per date) when the D+2 red risk reaches 50 % (adjustable)
- /api/today and /api/tomorrow: {"status":"ok","date":"2026-10-17","couleur":"BLEU","code":1}; status is "unavailable" until tomorrow's colour is published
- /api/predictions: day-by-day forecast up to D+15, with probabilite_bleu / probabilite_blanc / probabilite_rouge
- /api/remaining: days left per colour in the season
Code: Select all
-- EDF Tempo (France): today's and tomorrow's colour, red-day risk at D+2,
-- red days left. Source: free JSON API of calendrier-tempo.fr (no key)
-- Put the name (or idx) of your devices, or nil to skip one.
local DEVICES = {
today = 'Tempo today', -- Alert sensor
tomorrow = 'Tempo tomorrow', -- Alert sensor
redRiskD2 = 'Tempo red risk D+2', -- Percentage sensor
redLeft = 'Tempo red days left', -- Custom sensor
}
local NOTIFY_THRESHOLD = 50 -- notify if red risk at D+2 >= 50 % (nil = never)
local API = 'https://www.calendrier-tempo.fr/api/'
local LEVEL = { BLEU = 'ALERTLEVEL_GREEN', BLANC = 'ALERTLEVEL_YELLOW', ROUGE = 'ALERTLEVEL_RED' }
return {
on = {
timer = { 'every 30 minutes' },
httpResponses = { 'tempo_today', 'tempo_tomorrow', 'tempo_remaining', 'tempo_predictions' },
},
data = { lastNotified = { initial = '' } },
logging = { marker = 'Tempo' },
execute = function(domoticz, item)
local function device(key)
if DEVICES[key] then return domoticz.devices(DEVICES[key]) end
end
-- Update an Alert sensor only when the value changes
local function setAlert(d, level, text)
if d and (d.text ~= text or d.color ~= level) then
d.updateAlertSensor(level, text)
end
end
if item.isTimer then
for _, route in ipairs({ 'today', 'tomorrow', 'remaining', 'predictions' }) do
domoticz.openURL({ url = API .. route, callback = 'tempo_' .. route })
end
return
end
if not (item.ok and item.isJSON and item.json and item.json.status) then
domoticz.log('No usable response for ' .. item.trigger ..
' (HTTP ' .. tostring(item.statusCode) .. ')', domoticz.LOG_ERROR)
return
end
local j = item.json
if item.trigger == 'tempo_today' or item.trigger == 'tempo_tomorrow' then
local isTomorrow = (item.trigger == 'tempo_tomorrow')
local d = device(isTomorrow and 'tomorrow' or 'today')
if j.status == 'ok' and LEVEL[j.couleur] then
setAlert(d, domoticz[LEVEL[j.couleur]], j.couleur)
else
-- /api/tomorrow returns "unavailable" until the colour is published
setAlert(d, domoticz.ALERTLEVEL_GREY, isTomorrow and 'Not published yet' or 'Unknown')
end
elseif item.trigger == 'tempo_remaining' then
local d = device('redLeft')
if d and j.status == 'ok' and j.remaining then
d.updateCustomSensor(j.remaining.ROUGE)
end
elseif item.trigger == 'tempo_predictions' and j.status == 'ok' then
-- The list starts today; look for the D+2 date
local t = os.date('*t')
local dateD2 = os.date('%Y-%m-%d', os.time({ year = t.year, month = t.month, day = t.day + 2, hour = 12 }))
for _, p in ipairs(j.predictions or {}) do
if p.date == dateD2 and tonumber(p.probabilite_rouge) then
local risk = math.floor(100 * p.probabilite_rouge + 0.5)
local d = device('redRiskD2')
if d then d.updatePercentage(risk) end
if NOTIFY_THRESHOLD and risk >= NOTIFY_THRESHOLD and domoticz.data.lastNotified ~= dateD2 then
domoticz.notify('Tempo', 'Red day likely on ' .. dateD2 ..
' (risk ' .. risk .. ' %, forecast)', domoticz.PRIORITY_HIGH)
domoticz.data.lastNotified = dateD2
end
end
end
end
end
}- Setup > Hardware: add a "Dummy (Does nothing, use for virtual switches only)" hardware, e.g. named Tempo.
- Click "Create Virtual Sensors" on it: two Alert sensors ("Tempo today", "Tempo tomorrow"), one Percentage ("Tempo red risk D+2") and one Custom sensor ("Tempo red days left", axis label: days).
- Setup > More Options > Events: new dzVents script, paste the code, check the device names at the top (idx works too, or nil to skip one), tick "Event active" and save.
All fields are documented here: https://calendrier-tempo.fr/api-tempo
Data is CC BY 4.0, and every past forecast is published next to the real colour, errors included: https://calendrier-tempo.fr/historique-previsions
Feedback, bug reports or ideas for other fields are very welcome.
Jean-Pierre
https://calendrier-tempo.fr