Make offpeak hours available in Domoticz Settings

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

User avatar
lemassykoi
Posts: 37
Joined: Saturday 11 March 2017 23:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: France
Contact:

Make offpeak hours available in Domoticz Settings

Post by lemassykoi »

Please make off-peak hours available in Domoticz Settings so that plugins and scripts can use the values

Some people may have up to 3 off-peak hours per day, in my country
willemd
Posts: 735
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Make offpeak hours available in Domoticz Settings

Post by willemd »

That would need to cover a lot of different situations in different countries. For example what to do with dynamic energy pricing per 15 minutes?

You can easily implement it yourself by setting up one or more devices (switches) that indicate whether it is an off-peak hour or not. You can set those devices with a DZvents scripts using any logic you want. Using fixed hours, using imported external prices, using expected solar production. Anything.
zicht
Posts: 300
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: Make offpeak hours available in Domoticz Settings

Post by zicht »

I dont know how it works in your country.
In NL the message is inside the smartmeter data package and thus available/detectable in domoticz.
It would show in your domoticz log as "Smartmeter: Current electricity tariff: High" or "Smartmeter: Current electricity tariff: Low"
That is easy extractable.

If it is not in the datapackage there is nothing you can do (maybe building some timebased schedule = also easy doable )
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
User avatar
waltervl
Posts: 6678
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Make offpeak hours available in Domoticz Settings

Post by waltervl »

Please define offpeak hours.
Is that the hours with lowest energy tariffs? Do they differ per day based on wind/solar energy production?
Who or what is defining the offpeak hours? Your energy company? Yourself based on your own energy production?

For the Netherlands we have the Enever website wich supply energy tariffs per hour and even per 15 min (not implemented in Domoticz yet) https://wiki.domoticz.com/Enever
From that data you can define your offpeak hours.

But perhaps in France it is different please elaborate on this.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
lemassykoi
Posts: 37
Joined: Saturday 11 March 2017 23:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: France
Contact:

Re: Make offpeak hours available in Domoticz Settings

Post by lemassykoi »

waltervl wrote: Tuesday 03 February 2026 13:48 Please define offpeak hours.
Is that the hours with lowest energy tariffs?
For my usage, yes.

I'm working on a plugin to smart charge my EV car.
In France, most of users are with the national company, EDF.
Within this company, you can choose different contracts, for different power, single or tri phase, and you can select if you want some hours with lower cost (at night, in majority) = dual tariff.
"if you want" means you can select a "normal" contract, without any offpeak hours (single tariff).

I have a domestic battery which is charging during offpeak hours (23:30 - 7:30 for me)
the battery is set to always keep at least 50%
From 7:30, the battery is discharging until it reaches 50% (without solar, it happens around 13:30)
If solar production is good, the battery is able to charge and powering the home. Then the 50% is reached at 17:30, during this winter.
If and when I will have too much power, I will adapt the script.

My smart charge logic is:
when the car starts charging, check if we are in offpeak hours (wall charger is hard-coded to deliver energy only between 2330-0730).
if we are, calculate how much kWh is needed to reach the charge limit (read from the car), then reduce car charging power (amperage) so that charge ends at or before 7:30 (knowing min and max amps, and car battery capacity)
if we are not, check if car is lower than 25%
if yes, charge at max amps until 25%, then stop charge and wait for offpeak hours
if not, stop the charge

The goal is to use the lowest charge speed possible to reach the target, without using max power.
At the moment, I'm using a USB TIC device, which creates an alert sensor for offpeak hours (alert 1) or normal hours (alert 2).
But I wanted my plugin to be usable by everybody
As a replacement, I'm using User Variables.

As we are able to set Cost T1 and Cost T2 (in Settings, Meters/Counters), and those settings are readable from

Code: Select all

json.htm?type=command&param=getsettings
I was expecting the same feature for hours for T1 and T2

The advantage of this webpage (json.htm) is that it can be read without password if exception is set for 127.0.0.1

I also would like to see the current domoticz HTTP/HTTPS running port in this webpage, should I create a new subject?
I would use it to create a room plan at first plugin start to assign all new devices to a specific plan.
Here: OpenDTU Plugin I assume the port is 80

Thanks
willemd
Posts: 735
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Make offpeak hours available in Domoticz Settings

Post by willemd »

I think your expectation to also be able to read T1 and T2 hours with a json was understandable, but I guess the settings page with different tariffs was still based on the "old" model in the Netherlands with fixed off-peak hours between 23:00 and 07:00 and in weekends, similar to what you have in France. And since it was with fixed times for everybody (unless you had single tariff) , there was no need to define it in Domoticz. Even today, with more different forms of contracts, the smart power meters in the home still indicate tariff T1 or tariff T2, irrespective of the contract that is in place. We can actually use a P1 meter reader (like homewizard P1) to read the current active tariff.

Also very popular today in NL are dynamic contracts, with prices varying per hour or even per quarter, depending on your supplier, also because NL has a very high factor of solar power on houses. I guess in France with a more steady supply of nuclear the influence of wind and solar is less and therefore dynamic contract are less popular.

But looking at your plans and your current code, I have no doubt you can solve this issue yourselve.

I did not understand your questions at the end, so did not reply to those.
Kedi
Posts: 595
Joined: Monday 20 March 2023 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Somewhere in NL
Contact:

Re: Make offpeak hours available in Domoticz Settings

Post by Kedi »

I do the following:
With Nodered I fetch 15 minute prices for tomorrow from Nordpool every day at 18:01 and put them in a Domoticz variable.
That variable is at 23:59 processed by a big dzVents script (28Kb) for 1 to 3 slots of low prices set by various parameters.
The result of those 1 to 3 slots with low prices is put in a Domoticz text widget to be used the whole day by other dzVents scripts to switch on/off various device like washing machine, dryer etc...
That works perfect for me for years now.
Logic will get you from A to B. Imagination will take you everywhere.
User avatar
habahabahaba
Posts: 266
Joined: Saturday 18 March 2023 14:44
Target OS: Windows
Domoticz version: 2024.4
Contact:

Re: Make offpeak hours available in Domoticz Settings

Post by habahabahaba »

lemassykoi wrote: Friday 06 February 2026 4:47
I also would like to see the current domoticz HTTP/HTTPS running port in this webpage, should I create a new subject?
I would use it to create a room plan at first plugin start to assign all new devices to a specific plan.
Here: OpenDTU Plugin I assume the port is 80

Thanks
You can get current port in Dzvents:

Code: Select all

	local url = domoticz.settings.url
        local port = string.match(url, ":(%d+)")  -- get digits after ":"
        
        if port then
            domoticz.log('Current Dz port: ' .. port)
        else
            domoticz.log('No port number in URL: ' .. url)
        end
lost
Posts: 699
Joined: Thursday 10 November 2016 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Make offpeak hours available in Domoticz Settings

Post by lost »

willemd wrote: Friday 06 February 2026 10:15 I guess the settings page with different tariffs was still based on the "old" model in the Netherlands with fixed off-peak hours between 23:00 and 07:00 and in weekends, similar to what you have in France. And since it was with fixed times for everybody (unless you had single tariff) , there was no need to define it in Domoticz.
In France, there are in fact several historical "standard" possible off peak hour ranges (defined for a system driven by some primitive form of CPL working in broadcast mode from energy provider to customer power-counters, called Pulsadis, adding some frequencies over the main distribution 50Hz).

But the customer does not decide which off-peak hour he'll get: This is the electric network managing company (Enedis, that was split from EDF to allow 3rd party energy providers to get into the market "thanks" to Europe that likes complexity... and prices that were supposed to drop with an open market but the opposite happens!) that sets them to avoid big energy surges. So even your neighbor is likely to have different off-peak time slice than yours!

One T1-T2 range would as well not be enough: Off-peak periods (8h per day usually) can be contiguous or even split (like 2h-7h in the night and 14h-17h in the afternoon instead of 22h-6h)... and current trend is to go towards seasonal ranges: Contiguous at night in winter (to use nuclear power in homes when industry needs much less) and split the rest of the year (when there is nuclear maintenance and solar panels production is less marginal, especially at mid-day).

3rd party providers can also charge customers in very different ways (completely out of historical ranges) as energy counters data can now be retrieved every 30mn. So prices may change with this periodicity in the future...

If each country has it's own system and this becomes more and more complex, not easy to find commonalities for a Domoticz core implementation addition matching current charge rates. So IMO a flexible way to manage this would be through planning on a dedicated dummy off-peak switch device a script/plugin could read to know current pricing level.
User avatar
waltervl
Posts: 6678
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Make offpeak hours available in Domoticz Settings

Post by waltervl »

Domoticz does not know off-peak hours for P1.
When a gateway pushes data to the Domoticz P1 meter device the gateway decides if it sends high tariif or low tariff usage and return data.
https://wiki.domoticz.com/Domoticz_API/ ... mart_meter
/json.htm?type=command&param=udevice&idx=IDX&nvalue=0&svalue=USAGE1;USAGE2;RETURN1;RETURN2;CONS;PROD
IDX = id of your device (This number can be found in the devices tab in the column "IDX")
USAGE1= integer, total cumulative energy usage meter tariff 1 in Wh.
USAGE2= integer, total cumulative energy usage meter tariff 2 in Wh.
RETURN1= integer, total cumulative energy return meter tariff 1 in Wh.
RETURN2= integer, total cumulative energy return meter tariff 2 in Wh.
CONS= actual usage power (Watt)
PROD= actual return power (Watt)
So the Python plugin, build in Hardware gateway, dzvents/lua script or API call to Domoticz decides if data in P1 meter is entered and shown as high or low tariff. Domoticz does not know it. It is up to the integration to decide.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
waltervl
Posts: 6678
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Make offpeak hours available in Domoticz Settings

Post by waltervl »

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?

So in the Netherlands we have up to 4 meter counters (high return, high usage, low return, low usage) when you have a fixed High and Low tariff.
If you have only 1 fixed tariff (no High/Low) then you have 2 meter counters (usage and return), costs are yearly calculated.
When you have a flexible/dynamic tariff (changes possibly every hour or 15 min) you have 2 meter counters (usage and return). Costs are calculated real time based on the hourly tariffs. Domoticz supports this.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
lemassykoi
Posts: 37
Joined: Saturday 11 March 2017 23:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: France
Contact:

Re: Make offpeak hours available in Domoticz Settings

Post by lemassykoi »

I'm using plugin "Teleinfo EDF", which creates a P1 smart meter, and 1 low tariff counter, and 1 high tariff counter:

TIC Devices
TIC Devices
Screenshot_20260206_161559.png (49.17 KiB) Viewed 127 times
User avatar
waltervl
Posts: 6678
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Make offpeak hours available in Domoticz Settings

Post by waltervl »

lemassykoi wrote: Friday 06 February 2026 16:18 I'm using plugin "Teleinfo EDF", which creates a P1 smart meter, and 1 low tariff counter, and 1 high tariff counter:
So why then the request to have off peak hours in Domoticz? The plugin should be able to do that.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
lemassykoi
Posts: 37
Joined: Saturday 11 March 2017 23:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: France
Contact:

Re: Make offpeak hours available in Domoticz Settings

Post by lemassykoi »

As I said, I'm creating a plugin to smart charge my car.
I want everyone to be able to use my plugin and I don't want to ask for offpeak hours in the plugin settings. Not everyone have a TIC device or a sensor with offpeak data.

I would like to find it, as habahabahaba is able to do it with HTTP port and LUA

Unfortunately, no usable setting found in "Settings" and "Parameters" with python plugin
User avatar
waltervl
Posts: 6678
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Make offpeak hours available in Domoticz Settings

Post by waltervl »

I suppose your device "Teleinfo Tarif en cours" has the setting.
A python plugin can have no direct interaction with other devices, it is not designed for that. It would make things very complicated to move the plugin from one user to the other.
One option is to have your plugin create a similar "Teleinfo Tarif en cours" device and have a separate lua/dzvents script keep the 2 devices in sync so your plugin knows when there is a change.

Other possibility is to have your plugin poll the "Teleinfo Tarif en cours" with http api call. But then you have to poll....
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
lemassykoi
Posts: 37
Joined: Saturday 11 March 2017 23:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: France
Contact:

Re: Make offpeak hours available in Domoticz Settings

Post by lemassykoi »

waltervl wrote: Friday 06 February 2026 16:54 I suppose your device "Teleinfo Tarif en cours" has the setting.
You're right
waltervl wrote: Friday 06 February 2026 16:54 A python plugin can have no direct interaction with other devices, it is not designed for that. It would make things very complicated to move the plugin from one user to the other.
That's why I wanted to add offpeak data to domoticz internal settings. Same way as Cost T1 and T2.
User avatar
waltervl
Posts: 6678
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Make offpeak hours available in Domoticz Settings

Post by waltervl »

lemassykoi wrote: Friday 06 February 2026 17:00
waltervl wrote: Friday 06 February 2026 16:54 A python plugin can have no direct interaction with other devices, it is not designed for that. It would make things very complicated to move the plugin from one user to the other.
That's why I wanted to add offpeak data to domoticz internal settings. Same way as Cost T1 and T2.
If you would have added the plugin read issue directly on this question it would have saved us a big discussion .. ;)
What you are really asking is to read the state of any device in Domoticz by the plugin. And that is not possible.
To put the offpeak data in Domoticz settings is also not possible, how to update? Is it a fixed timeslot? Because then you also can put it as input parameters in the plugin.
But reading from the discussion it is a flexible setting so it cannot be a setting in Domoticz.
Cost T1 and T2 are no settings, only tariffs (as discussed before).

I think you better make a combination of plugin and scripting. The plugin to basically manage charging of your EV car (on/off) and some monitoring. The script to manage when and perhaps with what Ampere setting (eg when using also solar panel production) to charge your car.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
lemassykoi
Posts: 37
Joined: Saturday 11 March 2017 23:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: France
Contact:

Re: Make offpeak hours available in Domoticz Settings

Post by lemassykoi »

waltervl wrote: Friday 06 February 2026 17:23 What you are really asking is to read the state of any device in Domoticz by the plugin.
No.
waltervl wrote: Friday 06 February 2026 17:23 Cost T1 and T2 are no settings, only tariffs (as discussed before).
I'm not english native, maybe I have difficulties to make you understand what I think.
The offpeak start and offpeak end I'm asking for would only be informational, not used anywhere by domoticz (not an active setting)
Same for my need for active domoticz http port.

Currently, there is a lot of informations accessible from http://127.0.0.1/json.htm?type=command& ... etsettings
I can read the Kodi port, and the T1 and T2 tariffs

I just wanted to read what I'm asking for, rather than asking to the user within the plugin config, or asking him to create user variables.
I would like my plugin to be easy to use for non technical people.
Screenshot_20260206_191714.png
Screenshot_20260206_191714.png (26.28 KiB) Viewed 106 times
User avatar
waltervl
Posts: 6678
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Make offpeak hours available in Domoticz Settings

Post by waltervl »

You have 6 plugin parameters that you can use for your plugin users to set plugin settings. Perhaps you can use some of them to set the offpeak hours? The offpeak hours need to be fixed then.
If you make it smart you can use only 1 of those 6 parameters if you ask the users to type a string array to define the offpeak hours eg

Code: Select all

{1:00-4:00},{13:00-16:00},{19:00-24:00}
This string you can use in the plugin to check if current time is offpeak.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
lemassykoi
Posts: 37
Joined: Saturday 11 March 2017 23:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: France
Contact:

Re: Make offpeak hours available in Domoticz Settings

Post by lemassykoi »

thanks for the array tip
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest