Hi,
coming from fhem, I would like to write several things to a database when values of entities are changing (for grafana end more).
I know, there are shell scripts for that, but I do not want to poll - instead I want to push values as soon as they are changing.
In the best case I would like to have some kind of bulk action, so I do not have to write code/stuff for every single entity.
Does someone know how this can be done?
Best regards and thanks in advance,
Otto
There is no need to do this manually. Unless you have excluded an entity from the recorder database all changes are recorded automatically.
Thanks. I think my question was not clear enough.
I do not want to write to the HA database, but to a different one…
no one?
Which different database?
You’re not giving us much to go on here.
To a mysql or postgres database…
Ok, that helps but unfortunately I’m only familiar with writing to InfluxDB.
You can use includes or excludes to narrow down what is automatically recorded (every state change):
Hm. Thanks! I think I will have a look at that…
Best regards,
Otto
Honestly, I would use a timeseries database for this (either Prometheus or InfluxDB) over MySQL or Postgres. If you are dead set on using MySQL or Postgres, you could use something like NodeRed (or some other external tool) to write to another database. But really, InfluxDB is the easiest way to go with the least amount of friction.
well, i am a little bit old-fashioned
so I would really prefer a normal relational database where I have full control and know what I am doing…
but thanks a lot!
hahaha old school DBA myself, so I get it. But also, choose the best tool for the job. MySQL kinda sucks at timeseries data (imho).
InfluxDB has a learning curve with it’s Flux language, but it’s not insurmountable and actually pretty easy once you get accustomed to it. Plus, Grafana makes querying a breeze.
well. yes. but I am not sure if I really want to get so close to influx…
Thanks for your tips, I think I will have another close look at influx…