I think the big mistake here is mixing persistence and export. In
reality you will never use outside services like ThingSpeak, Pachube
and others for data to persist. You will use this services to export
this data to outer world without providing access to your system.
Someone would like to export certain graphs to their website/blog
(like me), someone just want to use it for research reasons and so on.
While persistence in general in openHAB is needed to recover from
crash, log events and commands, get historical reporting. From my
point of view there should be two separate mechanisms for that. I
think that we need to put all data going through the system to local
persistent storage for many reasons. Example with events history view
from your mail is just one of them. Crash recovery scenario is not
that good example, cause there could be some changes in real life
during the period of openHAB absence, so I would prefer to have a
mechanism of getting current state from the bus during openHAB
startup. You do not need to configure local persistence anyhow then,
probably we only need to create some logging-like configuration
mechanism, which will limit the amount of data stored locally,
filtering the data like debug/info/warning in terms of events.
Export services should be configured on a per-service basis in
openhab.cfg I think, cause I see no difference between a KNX bus
access configuration and ThingSpeak or Pachube account configuration.
It's just a pipe to push and pull some data (probably in future this
services will provide not only data storage but supply some events
too, I don't know, they could rise as data exchanges between different
systems for cloud based analysis and data exchange. For example if
certain amount of houses export high wind speed in the same area it
means some trouble coming...). You need to map items to this services
data storage then somehow in items configuration, but that is not big
deal, cause probably you will not be exporting 100 devices to the web
:-) At least I can't imaging a workable scenario for that. :-)
Pros: no or at least very small config for local persistence, small
config per export service, small config per item and not so many items
to configure
Cons: not that super flexible as your scenarios, but much closer to a
real user, not geek ;-)
Historical data access from local persistence is still a trick and I
fully agree about approximation and timeline stuff, it's needed in
real life scenario of users accessing their data.
Pros: it's needed badly for this type of system
Cons: Have to spend some efforts to implement
Best regards,
Victor Belov
> --
> You received this message because you are subscribed to the Google Groups
> "openhab" group.
> To post to this group, send email to ope...@googlegroups.com.
> To unsubscribe from this group, send email to
> openhab+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/openhab?hl=en.
Thanks for your quick feedback!
> I think the big mistake here is mixing persistence and export.
I see your point - you will actually never query data from IoT services. Still, some basic querying can be done on them as well as they offer data feeds as JSON or XML.
> In reality you will never use outside services like ThingSpeak, Pachube
> and others for data to persist.
But fact is, if you "export" your data to them, they will "persist" it. So like it or not - your data is persisted by this service.
I think the main reason for people wanting to persist their data is charting; and this is exactly what these services are offering. So imho they are a valid way to persist data. People store so much in the cloud these days and do not care about having a local copy of it, so why not in this case as well?
> Crash recovery scenario is not
> that good example, cause there could be some changes in real life
> during the period of openHAB absence, so I would prefer to have a
> mechanism of getting current state from the bus during openHAB
> startup.
Agreed, but for certain items it makes sense. In my case, my physical devices are connected through KNX and the openHAB KNX binding reads the status of almost all of them at startup. On other systems, you might not get feedback at all, so you have to trust what openHAB shows you - and if this is the same after a restart, it can be very helpful. The other types of items where it makes sense are the "virtual" ones, like "Presence", "Mood" etc. As there is no physical bus, they cannot be retrieved from anywhere else.
> cause probably you will not be exporting 100 devices to the web
> :-) At least I can't imaging a workable scenario for that. :-)
If I count my temperature, weather and other sensors, I end up at over 30 already… So the limiting fact will probably be the API restrictions of these IoT services that you had mentioned in your previous mail...
> Historical data access from local persistence is still a trick and I
> fully agree about approximation and timeline stuff, it's needed in
Ok, so what I summarize from your feedback is, that it might make sense to regard "export only persistence" and "queryable persistence" independently. Still, I think it makes sense to find a common way for the configuration as the export/persistence strategies should be fairly similar.
Regards,
Kai
I think you are missing an important point here. openHAB is meant to
be an open platform, easily extensible to integrate with other systems
- and not an off-the-shelf product with a "buy it as is or leave it"
approach.
People might have their own databases already set up (MySQL, MongoDB,
whatever) and would like to use these for the persistence. Hence
adding a new implementation of a persistence service should be made
easy. And yes, some services might be cloud-based (with all their
disadvantages), others might not. Conceptually, I do not see a reason
to draw a line between them.
> The regular user (and system integrator) just wants to get charts and
> graphics. In general he doesn't care where and how this data is
> stored.
I agree that there should be a decent default setup, so that the
uninterested user does not have to know about things like rrd4j db4o
etc. But the advanced user should have the possibility to configure
all of these things to his needs.
> "persist="1m>22.5" (every 1 minute when the value is above 22.5).
This already involves the evaluation of expressions - I think with
such requirements, option (1), i.e. dedicated rules is probably the
way to go.
Regards,
Kai
You guys are talking about different databases, not persistent storage
schemes. Using one database or another is just a question of DAO or
object-rdbms or object-nosql mapping... There are plenty apps in the
world which can run on top of different databases.
I have another clue - we need to stay away from sql, cause the task
openHAB is working on is closer to object storage and non strict data
structure. Again mongo or mysql will limit usage of embedded platforms
very much...
And at the end of the day you can't make everybody happy. Any openness
must have limitation or it will sink in the process without result :-)
Sent from my iPhone
My main point is that I want to have a service/interface defined that
should allow different implementations. And I deliberately include
"export" implementations here as well (they would simply not implement
the query part of the interface).
In general, I would like to note that openHAB is already very useful
without ANY persistence. Take version 0.9.0 and convince yourself ;-)
So to me, ANY persistence implementation is optional and not per-se
required. This might change, once we have a notification API as these
would need to be stored somewhere. But my first use case that I want
to realize is storing time series in rrd files. I am using an external
rrdtool installation at the moment for this and would like to replace
it. Charting would be done directly through rrd4j, so I wouldn't need
querying of this persistence store through openHAB. This is therefore
quite similar to ThingSpeak. So is this now persistence or export? I
really do not want to make a strict difference here.
For some events like alarm items I would prefer a durable and
query-able persistence, such as db4o. So you see, I will have
different implementations in use right from the start...
And the question of configuration is the same for all persistence
services. You want to be able to define the same kind of
persistence/export strategies for all of them. That's another reason,
why I would like to find a common concept and syntax for the
configuration. It imho does not make sense to invent different ways of
configuration for them.
Regards,
Kai
Let me first summarize a few major points I would like to address:
1. Possibility to have the choice between different "persistence services". Implementations I would like to have here for the start: db4o, rrd4j, ThingSpeak2. Different "data capture" strategies like: "persist every event", "persist a value every x seconds", "persist ONLY the very latest status" (just to be able to recover from crashes), some RRD way "only keep 1000 values taken every second, 1000 every hour, 1000 every day"3. The strategy and the persistence implementation should be configurable for each item - possibly even multiple strategies for different implementations for the same item4. There must be a powerful query mechanism to get data / timeseries out again. Especially for charting it should be possible to e.g. get equidistant values even though the strategy might have been "every event". For this, there must be a pluggable system to provide different implementations for data interpolation (or even extrapolation). This query API should then be usable for a REST service that can be used for charting engines as well as for http://code.google.com/p/openhab/issues/detail?id=485. Besides the persistence of item states, I would also like to have the possibility to persist other kinds of events/notifications. Commands are one of them, alarm messages might be others. We might have to introduce some notification API in openHAB first (result should be that one can realize something like http://goo.gl/GpZ4H)
1. Using rules (similar to https://groups.google.com/d/msg/openhab/WZ_unJb43ag/pa2u3_8cFeQJ)Pro: No additional implementation/concept required for the configurationCon: Many rules to write, quite a lot of code and not very concise
6. A completely new file type "*.persistence" with its own syntax and editor (same information as in (5). The link from items to persistence configs could then be either made by adding a reference in the item or in the persistence files.Pro: Full editor support, dedicated file, so no concept mix with the items; good for supporting "non-item" data, such as in requirement (5) aboveCon: A new DSL syntax to define, create and learn; files might not have a lot of information inside after all (and a single file will be in general enough)
Absolutely agreed - it's an option for advanced requirements :-)
> The existing items-file is just one option to provide items to openHAB. Conceptually there are many other ways to provide items as well (see BindingProvider).
Very good point, I forgot about this. Indeed, this cancels all options about putting the information in the item files.
> Therefore i would prefer to configure persistence by a new file. I am not sure if this has to be a new DSL or if a plain properties file will do the job as well (like option 5 - with the given Pros and Cons).
If a new file, I would go for a DSL to have the full IDE support, which I think is very helpful if one is not 100% clear about the correct syntax.
Yes, this is indeed a simple solution which does not even require any implementation. But this solution has quite some restrictions:
- You can only use storages with JDBC drivers (i.e. in general only RDBMS)
- You can only use "every event" strategy, i.e. you could not send a value every minute.
- You cannot activate it for only some items or items of certain groups.
Regards,
Kai
I would like to contribute some reflections to this subject: