I have a script that reads the readings from the PZEM-004t and the kWh cost from the Domoticz settings. At the end, the monthly electricity bill is calculated. Everything works great, I like it.
There was a desire to adjust the tariff in automatic mode. The electricity supplier has a website that publishes current tariff prices. I can read them from the site, but I want to write them to "Costs T1" and "Costs T2" in the "Meters / Counters" tab of the settings through the dzVents script. Is it possible to do this without having to edit the Domoticz database?
P.S. I tried to make the following request to the database from dzVents:
Code: Select all
'/usr/bin/sqlite3 /opt/domoticz/domoticz.db "UPDATE Preferences SET nValue=' .. price .. ' WHERE key="' .. key .. '"'
P.P.S. I managed to update the data through the request, my mistake was in the wrong pair of quotes in the request. But it still seems to me that this is not a very good way to update data in settings