Skip to content

Conversation

@duvholt
Copy link
Contributor

@duvholt duvholt commented Jun 7, 2025

I'm opening this as a draft PR since it depends on config changes that are only in the web ui branch (which I partially cherry picked into this branch).

I replaced tzfile with chrono-tz for two reasons:

  • We need a list of all available timezones (chrono_tz::TZ_VARIANTS)
  • tzfile doesn't work on Windows (not a big deal imo, but maybe some people want to run bifrost directly on windows in the future?)

Unfortunately this feature won't properly work since timezone is both read from the config (config.yaml) and the state. Some endpoints use the config as a source of truth for this and others are directly from the state. The Hue app uses the resource state so updating the timezone in the app will end up reverting itself after the app refetches data.
Before this PR the timezone in the state file was always based on guessing the timezone.

To properly fix this I think we should introduce some concept of "in memory" state that is read/updated separately from the persistent state. I think all the resources created in add_bridge fit this definition. This will also likely be needed for the upcoming behavior script I will add in a future PR as otherwise we have to tell users to delete their state file.

@chrivers
Copy link
Owner

Very good points!

I've bumped into similar problems with the web ui, since we need to be able to rewrite the config, in order to add a backend, for example.

Over time, we definitely need to re-think the configuration model. I think it would be much cleaner to configure everything through the web ui, and have some machine-managed configuration along with the state. It would probably be a separate file, but it could even be the same file.

In any case, thanks for the interesting PR! I'll take a proper look soon :)

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

Successfully merging this pull request may close these issues.

2 participants