Page 2 of 2
Re: Make offpeak hours available in Domoticz Settings
Posted: Saturday 07 February 2026 12:28
by lost
waltervl wrote: Friday 06 February 2026 16:13
Additional for France: Your electricity counter does it have 1 meter and multiple/flexible tariffs or multiple meter counters eg 1 for high and 1 for low tariff?
Or even more meter counters? And also splitted for usage and production?
There is 10 counters: 1 for injection for those who produce and up to 9 can be used for consumption depending on contract (IMO, max current use-case is 6: normal/off-peak hours for the 3 "colors" Tempo contract with 300 "blue" days a year low prices, 43 "white" mid prices and 22 "red" high prices).
On top of these 10 counters, there is a 11's one (MID=Total of all consumption) for conformance/CE purpose.
So that's becoming a lot! But most current contracts just use 1 (fixed price) or 2 (normal/off-peak)... and many users that used 6 (Tempo) are currently back to 2 as EDF just rise Tempo contract prices up to not being a bargain anymore ("red" days, during 16 normal hours, you really had to be very careful so when prices do not justify the hassle anymore you quit!).
In 2022/2023 there was many nuclear power unavailable due to some corrosion issues + war in Ukraine so there was a big push to Tempo... But now, more power than needed and even export records to Germany etc... and Spain that was again near blackout due to (too) high renewable production that was suddenly switch off during high winds.
Make offpeak hours and http ports available in Domoticz JSON Settings Page
Posted: Saturday 07 February 2026 21:58
by lemassykoi
This patch is doing what I want:
Code: Select all
diff --git a/main/SQLHelper.cpp b/main/SQLHelper.cpp
index e6bafa88a..91b351fee 100644
--- a/main/SQLHelper.cpp
+++ b/main/SQLHelper.cpp
@@ -3750,6 +3750,14 @@ bool CSQLHelper::OpenDatabase()
{
UpdatePreferencesVar("P1DisplayType", 0);
}
+ if (!GetPreferencesVar("OffPeakStart", sValue))
+ {
+ UpdatePreferencesVar("OffPeakStart", std::string("23:30"));
+ }
+ if (!GetPreferencesVar("OffPeakStop", sValue))
+ {
+ UpdatePreferencesVar("OffPeakStop", std::string("07:30"));
+ }
SetUnitsAndScale();
diff --git a/main/WebServerCmds.cpp b/main/WebServerCmds.cpp
index 9f313b67c..a55799545 100644
--- a/main/WebServerCmds.cpp
+++ b/main/WebServerCmds.cpp
@@ -2462,6 +2462,8 @@ namespace http
m_sql.UpdatePreferencesVar("HourIdxElectricityDevice", atoi(request::findValue(&req, "HourIdxElectricityDevice").c_str())); cntSettings++;
m_sql.UpdatePreferencesVar("HourIdxGasDevice", atoi(request::findValue(&req, "HourIdxGasDevice").c_str())); cntSettings++;
m_sql.UpdatePreferencesVar("P1DisplayType", atoi(request::findValue(&req, "P1DisplayType").c_str())); cntSettings++;
+ m_sql.UpdatePreferencesVar("OffPeakStart", request::findValue(&req, "HomeOffPeakStart")); cntSettings++;
+ m_sql.UpdatePreferencesVar("OffPeakStop", request::findValue(&req, "HomeOffPeakStop")); cntSettings++;
/* More complex ones that need additional processing */
@@ -4999,7 +5001,19 @@ namespace http
{
root["P1DisplayType"] = nValue;
}
+ else if (Key == "OffPeakStart")
+ {
+ root["HomeOffPeakStart"] = sValue;
+ }
+ else if (Key == "OffPeakStop")
+ {
+ root["HomeOffPeakStop"] = sValue;
+ }
}
+ root["HTTPPort"] = m_mainworker.GetWebserverPort();
+#ifdef WWW_ENABLE_SSL
+ root["HTTPSPort"] = m_mainworker.GetSecureWebserverPort();
+#endif
}
void CWebServer::Cmd_GetLightLog(WebEmSession& session, const request& req, Json::Value& root)
diff --git a/www/app/SetupController.js b/www/app/SetupController.js
index bc5c2dc74..e2b86f515 100644
--- a/www/app/SetupController.js
+++ b/www/app/SetupController.js
@@ -638,6 +638,12 @@ define(['app'], function (app) {
if (typeof data.CostWater != 'undefined') {
$("#rfxmetertable #CostWater").val(data.CostWater);
}
+ if (typeof data.HomeOffPeakStart != 'undefined') {
+ $("#rfxmetertable #HomeOffPeakStart").val(data.HomeOffPeakStart);
+ }
+ if (typeof data.HomeOffPeakStop != 'undefined') {
+ $("#rfxmetertable #HomeOffPeakStop").val(data.HomeOffPeakStop);
+ }
if (typeof data.RandomTimerFrame != 'undefined') {
$("#randomtable #RandomSpread").val(data.RandomTimerFrame);
}
diff --git a/www/views/setup.html b/www/views/setup.html
index 33b22d101..4e38e89fe 100644
--- a/www/views/setup.html
+++ b/www/views/setup.html
@@ -972,12 +972,16 @@
<td><input type="input" id="GasDivider" name="GasDivider" style="width: 80px; padding: .2em;" class="text ui-widget-content ui-corner-all"></td>
<td align="right" style="width:60px"><label><span data-i18n="Costs"></span>: </label></td>
<td><input type="input" id="CostGas" name="CostGas" style="width: 60px; padding: .2em;" class="text ui-widget-content ui-corner-all"> / m3</td>
+ <td align="right" style="width:90px"><label>OffPeak Start: </label></td>
+ <td><input type="text" id="HomeOffPeakStart" name="HomeOffPeakStart" style="width: 60px; padding: .2em;" class="text ui-widget-content ui-corner-all" placeholder="HH:MM"></td>
</tr>
<tr>
<td align="right" style="width:80px"><label><span data-i18n="Water"></span>: </label></td>
<td><input type="input" id="WaterDivider" name="WaterDivider" style="width: 80px; padding: .2em;" class="text ui-widget-content ui-corner-all"></td>
<td align="right" style="width:60px"><label><span data-i18n="Costs"></span>: </label></td>
<td><input type="input" id="CostWater" name="CostWater" style="width: 60px; padding: .2em;" class="text ui-widget-content ui-corner-all"> / m3</td>
+ <td align="right" style="width:90px"><label>OffPeak Stop: </label></td>
+ <td><input type="text" id="HomeOffPeakStop" name="HomeOffPeakStop" style="width: 60px; padding: .2em;" class="text ui-widget-content ui-corner-all" placeholder="HH:MM"></td>
</tr>
</table>
</div>
successfully tested on the dev branch
Re: Make offpeak hours available in Domoticz Settings
Posted: Saturday 07 February 2026 23:19
by waltervl
So you want to have the French offpeak hours in Domoticz? Why? I already explained to you how it could be done in a plugin ...
But you are free to make a PR, I doubt it will be accepted.
But perhaps I am missing the logic here ...
Re: Make offpeak hours available in Domoticz Settings
Posted: Sunday 08 February 2026 10:03
by lost
waltervl wrote: Saturday 07 February 2026 23:19
But you are free to make a PR, I doubt it will be accepted.
+ it's only 1 range...