One of my measurements should be created once a DAY and I do that with cron rule.
However if I do a select in the DB it is populated by thousands of the replicated result.
> drop MEASUREMENT B_Power_energy_daily_log
> select * from B_Power_energy_daily_log
name: B_Power_energy_daily_log
------------------------------
time value
1484750628004000000 1.85
1484750629004000000 1.85
1484750630006000000 1.85
1484750631004000000 1.85
Why is that? my influx persist is following: And I guess that does not explain why there is one value per second there.
* includes everything, including B_Power_energy_daily_log. Thatâs why your item is currently persisted every second as you defined it.
What you should do is use the above definitions and you should not persist everything. You should only persist specifically what you want to graph or analyze later.
WOW! thats why influx is killing my RPI3! Thanks.
Is there a way to use default persist every minute and only take away one two sensors.
I want to persist 90% every minute as I graph almost everything with Grafana and it has some problems when the value does not change within the graph window. Setpoints or motion sensors are the most often ofenders that brake the graphs.
Persisting every minute is really not a good idea. You should use everyChange to catch actual changes and maybe everyHour to have support points for only seldomly updated items. As you can see Iâm not even doing that for all items. I canât imagine you really have the need for minutely accurate graphing!?
How do they do that? No change will normally not be of any harm.
Ok I fixed my install and now my energy readout does sum() properly as there is no dupes. but it did break Grafana graphs in the thermostat section when I have valve states and setpoints.
So I have now manualy add those to persist every minute to fix the graphs.
As you can see the water setpoint is missing both ends on the graph. last() selector is not fixing that.
fill (previous) is fixing the missing end near the now() (right part) but for the mising part on the left I could not find a fix other then provide more granular data into DB
Also if the value did not change over 24h it will be completely missing from the graph.
I had to open some valves by hand and change the setpoints to make them into the graph as they were totaly omitted despite the fact the metric on the graph was still there.
But I do have much more concerining issue related to the orginal post.
I have croned ruled that on 21:06 should write daily value to the DB. it is simple as possible
rule "Update max daily energy value"
when
Time cron "0 6 22 1/1 * ? *"
then
var Number tmp
var Number today_max = B_Power_energy_today_float.state
tmp=today_max.floatValue
logDebug("TERMO","---------Daily solar max sent to db:" + tmp )
postUpdate(B_Power_energy_daily_log, tmp)
end
In the log I see it gets called twice 4ms apart from each other and that results in 2 values in the DB.
2017-01-19 22:06:00.032 [DEBUG] [eclipse.smarthome.model.script.TERMO] - ---------Daily solar max sent to db:5.951
2017-01-19 22:06:00.036 [DEBUG] [eclipse.smarthome.model.script.TERMO] - ---------Daily solar max sent to db:5.951
Ah that⊠Yes thatâs âokayâ as in expected. That is why I mentioned to go the middle way and add hourly points. This is the way Grafana draws diagrams and yes, that could be improved but it really doesnât matter much if you look at the diagram with a range of one day or one week. Hereâs an example from my system (hourly values, pay attention to the tiny space at the left):
At the end I believe for your Temperature diagram an hourly rule is okay. For other kinds of data or devices other settings might be beneficial.
Another Example: One of my âsensorsâ is sending data only periodically every 10 minutes and values in between can be linearly interpolated. I am only using the onChange strategy because a cron based strategy would actually inject false data.
2017-01-20 22:06:00.029 [DEBUG] [eclipse.smarthome.model.script.TERMO] - ---------Daily solar max sent to db:12.539
2017-01-20 22:06:00.058 [DEBUG] [eclipse.smarthome.model.script.TERMO] - ---------Daily solar max sent to db:12.539
This could be a real bug⊠If we can find the cause we should file a bug report for it.
You are using a RPi3. Which way did you install openHAB and which revision are you on? WHat is the name of your rule file, are there any other rule files present that do not work correctly or empty? Please check the rule file for formatting error or similarâŠ
Stop openHAB, clear out cache and tmp and start again.
There are other threads discussing this issue add well. I might be seeing this too but am not sure as Iâve been doing a lot of changes in how my rules are triggered.
I did openhabian on RPI3, this night I updated from 653 to the latest snapshot 743.
I only have single rules.file called default.rules
I only have a single crone rule in the rules file, all other trigger on the sensor or input changes and generaly work ok. Iâll clrear tmp and wait until today trigger at the end of day.
Now That I deleted it I cant check that back. But Iâm quite positive it looked like a space. I only edit rules files on the RPI one way. And that is with Notepad++ on the SMB share on the OH2 machine.
I can see that it was set to the Windows style of the line ends CR LF and not to the unix LF only