Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: Support persistence config in items builder #197

Open
jimtng opened this issue Nov 28, 2023 · 0 comments
Open

Idea: Support persistence config in items builder #197

jimtng opened this issue Nov 28, 2023 · 0 comments

Comments

@jimtng
Copy link
Contributor

jimtng commented Nov 28, 2023

So that we can specify how the item should be persisted in items builder too.

items.build do
  number_item Number1 do
    persist :on_change # add to the default persistence
    persist %i[on_change on_update], service: :influxdb # add to influxdb persistence
  end

  number_item Number2, persist: :on_update

  number_item Number3 do
    persist %i[on_update on_change], 
      every: 5.minutes, 
      service: influxdb, 
      filter: ->(value) { value.between?(5, 10) }
  end

  number_item Number4, persist: { cron: "* * * * * *" }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant