Page 1 of 1
Update sensor via json api with future time?
Posted: Monday 24 January 2022 16:51
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¶m=udevice&idx=IDX&nvalue=0&svalue=VALUE&datetime=yyyyMMddhhmm
Thanks in advance
Re: Update sensor via json api with future time?
Posted: Wednesday 26 January 2022 23:09
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?
Re: Update sensor via json api with future time?
Posted: Thursday 27 January 2022 8:35
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=
Re: Update sensor via json api with future time?
Posted: Thursday 27 January 2022 13:36
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.
Re: Update sensor via json api with future time?
Posted: Thursday 27 January 2022 14:12
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.
Re: Update sensor via json api with future time?
Posted: Thursday 27 January 2022 17:09
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.
Re: Update sensor via json api with future time?
Posted: Thursday 27 January 2022 19:19
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.
Re: Update sensor via json api with future time?
Posted: Friday 28 January 2022 7:10
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…
Re: Update sensor via json api with future time?
Posted: Friday 28 January 2022 8:38
by Madcat
yep, both are the actual prices, at least for easy energy.
some providers do an predicted price + extra