Automation and DB write

Hello.

My HA automation not always execute, especially for fast re-use. Analyze executed steps I found that some trigger condition based on HA entity from Z2M not pass (false condition check). However in real the condition should be true.

My question is can be above issue connected to how fast I write data to DB? My recorder setting is set to write every 60s but my trigger check condition of entity after 2-3sec after real change related entity.

So can be this true: Z2M device change own status and send MQTT update message to HA, HA receive it and process almost in real time. But HA entity will update DB up to 60s (let say average after 30s). Parallel after send Z2M message to HA I wait 2-3sec and execute trigger where is checked condition of the entity. What will be result? DB not updated but Z2M MQTT has been processed in HA?

What check automation entity condition, DB record of entity or real state from memory (if something that exist)?

BR, Krzysiek

Hello oneiro,

It depends.

  • What kind of server are you using
  • What kind of storage is that server using.
  • How much memory does your server have
  • What kind of network are you using
  • Is your problem with cloud based devices or local devices. (Check the Integrations Documentation to tell that)
  • How big is your database
  • Are you using the default sqlite or something else
  • Do you have any custom integrations that are causing problems

I could go on…
It’s like asking how come it takes so long to drive to work.
It depends…

Hi Sir Goodenough.

I’m using Wyse 5070 as VM server, assign to HAOS 2 core, 16 GB RAM from 30 GB available, 120 GB GB (it is SSD Nvme), 1 GB LAN., I would not searching problems here.

Yes, my DB is huge 6.7 GB sqlite because keep data 30 days but general no facing issues performance, response is very good.

The device is local Zigbee. And yes, have a lot MQTT messages, maybe here is some delay in queue. Do you know how check MQTT queue, how long processing take place?

And on end DB, as I wrote I save DB every 60s. My question what is functional logic behind HA automation in my case? The automation checking entity state read from DB or from “memory”?

BR, Krzysiek