Update sensor via json api with future time?

Moderator: leecollings

Post Reply
Madcat
Posts: 4
Joined: Monday 24 January 2022 16:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Contact:

Update sensor via json api with future time?

Post by Madcat »

Hi,

I have a question about the API, is there a way i could set the value of a certain sensor in the future (or past)?

In the netherlands we have variable prices for power and gas and have created a script in node-red to calculate when it's the cheapest to charge my tesla.
I would like to store the values of the energy price in domoticz because it's more persistent.
The issue is that the prices are known on a certain time, and i then would like to store it and not update that price every hour.

i have checked https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s but i only see something about timers.
Is there a way to do this or am i asking the impossible ;)

it would be nice if i could something like:
/json.htm?type=command&param=udevice&idx=IDX&nvalue=0&svalue=VALUE&datetime=yyyyMMddhhmm

Thanks in advance
User avatar
waltervl
Posts: 5842
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Update sensor via json api with future time?

Post by waltervl »

There is no future time storage in the database.
What you could do is make use of user variables https://www.domoticz.com/wiki/Domoticz_ ... _variables
Make tariff_1hr, tariff_2hr etc where you than can calculate your optimal time schedule
Or do the calculation completely in Domoticz and use Dzvents persistant data and also use Dzvents to do the calculation... https://www.domoticz.com/wiki/DzVents:_ ... stent_data
But as you have it already in node-red it would be extra work....

Where do you get the prices from in the future?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Madcat
Posts: 4
Joined: Monday 24 January 2022 16:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Contact:

Re: Update sensor via json api with future time?

Post by Madcat »

Is there a way to side-load it into the database?
Rewrite data from the past is also okey, i would like to analyse the data to i can create some patterns.
Right now i can only calculate when it's the cheapest to charge my car for the next day, but maybe it's cheaper to hold and charge the day after.

future as in, the next 32 hours:
i grab it from:
https://transparency.entsoe.eu/
https://transparency.entsoe.eu/api?docu ... yToken=xxx

and
https://mijn.easyenergy.com/nl/tarieven
https://mijn.easyenergy.com/nl/api/tari ... &grouping=
User avatar
waltervl
Posts: 5842
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Update sensor via json api with future time?

Post by waltervl »

There is an API call for uploading historical counter data but only for daily data, not hourly. I tried it once to upload my historical electricity data but failed.

It is just an SQLite database so you can store in it whatever you want as long as you know what you are doing and don't screw up the complete database. I personally would never go this way.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Update sensor via json api with future time?

Post by EddyG »

If you do the calculation in dzVents then you also could use customEvents in have something set / switched / or whatever in the future for 1 week in the future, as I would conclude from the documentation, although I did not test test that.
I have a script running that does such a thing for today or the next day in the future, and that works fine for more then a year now.
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Update sensor via json api with future time?

Post by EddyG »

Now I think about it. Strange question.
Normally variable Energy prices are updated twice a year. Now with current energy market some supplier switch over to change there prices every month. Still you got a fixed price during the month. I think there is no real benefit in deciding I you charge your Tesla on the 31 of the month or on the 1 of next month. And you have to charge the car anyway.
And if you get your energy from the mentioned link then it is obvious that prices are at its lowest in the middle of the night.
Madcat
Posts: 4
Joined: Monday 24 January 2022 16:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Contact:

Re: Update sensor via json api with future time?

Post by Madcat »

In the Netherlands the price is now changed every hour by some providers, but indeed some are also changed every month.
'Budget Energy' for example has a price of 35 cent this month and 45 cent next month, but for easyenergy the price is 24 cent at 2 am. it save 11 cent per kw and if you charge for example 65KW it saves about 7 euro each charge.
The price is not always the cheapest in the night, it depends, that's why i created a small script to analyse the data and act on it.
User avatar
kiddigital
Posts: 438
Joined: Thursday 10 August 2017 6:52
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Update sensor via json api with future time?

Post by kiddigital »

These future prices, are these the predicted prices from the provider? And do they keep them as the actual price? Or could the actual price for a certain hour be different from the ‘quoted’ price? Would be great if they stick with the quoted price because than you are sure about savings. If it is only predicted and the actual price is different, than when more people are optimizing , the actual prices will be higher…
One RPi with Domoticz, RFX433e, aeon labs z-wave plus stick GEN5, ha-bridge 5.4.0 for Alexa, Philips Hue Bridge, Pimoroni Automation Hat
One RPi with Pi foundation standard touch screen to display Dashticz
Madcat
Posts: 4
Joined: Monday 24 January 2022 16:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Contact:

Re: Update sensor via json api with future time?

Post by Madcat »

yep, both are the actual prices, at least for easy energy.
some providers do an predicted price + extra
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest