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

Currently active page variable or sensor #64

Open
nagyrobi opened this issue Feb 9, 2024 · 5 comments
Open

Currently active page variable or sensor #64

nagyrobi opened this issue Feb 9, 2024 · 5 comments

Comments

@nagyrobi
Copy link

nagyrobi commented Feb 9, 2024

For uses like:

script:
  - id: back_to_main_page_after_delay
    mode: restart
    then:
      - delay: 120s
      - if:
          condition:
            id.of.active page != main_page  # or is_page_active: main_page    etc
          then:
            -  lvgl.page.show: main_page
@nagyrobi
Copy link
Author

nagyrobi commented Feb 9, 2024

Oh. just noticed I already mentioned something like this #9 (comment)

@clydebarrow
Copy link
Owner

ESPHome automations don't permit expressions as such (except in lambdas) so it's not possible to have something like "!=" in a condition. Conditions are only boolean values, so something like the existing display condition:

  not:
      lvgl.is_displaying_page: main_page

would be possible (not implemented yet!)

But this is what I'm using ATM which works just fine.

lvgl:
  on_idle:
    timeout: 15s
    then:
      - lvgl.page.show: main_page

@nagyrobi
Copy link
Author

nagyrobi commented Feb 9, 2024

This comes to my mind, that how many timeouts can we configure?
Is this possible?

lvgl:
  on_idle:
  - timeout: 15s
    then:
      - lvgl.page.show: main_page
  - timeout: 60s
    then:
      - light.turn_off: display_backlight
  - ...further timeouts

@clydebarrow
Copy link
Owner

As many as you want. That was the whole point :-)

@nagyrobi
Copy link
Author

The second timeout doesn't trigger for me:

lvgl:
  on_idle:
  - timeout: 15s
    then:
      - light.turn_off: display_backlight
      - lvgl.pause:
  - timeout: 60s
    then:
      - lvgl.page.show: main_page
  - ...further timeouts

I assume, the timeout counter doesn't increase while LVGL is paused...?

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

2 participants