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

Frontend automation does not want to work #32

Open
anoril1979 opened this issue Oct 17, 2021 · 1 comment
Open

Frontend automation does not want to work #32

anoril1979 opened this issue Oct 17, 2021 · 1 comment

Comments

@anoril1979
Copy link

Hi!

I've just installed ios-themes. Themes appear in the theme dropdown in the user parameters. Themes are well applied from there.

I then added your frontend automation file. Automations are well listed in my automation list. But when I click on "execute", nothing happens.
I set the entities panel with the theme selector input, aside with dark mode toggle and alternative theme toggle. Every thing is well presented on my lovelace. But when I selected a theme from the drop down list, toggle the dark mode knob or the laternative knob, nothing happens.

Using HA 2021.8.8, User Interface 20210909.0

System Health

version core-2021.8.8
installation_type Home Assistant Core
dev false
hassio false
docker false
user sc-homeassistant
virtualenv true
python_version 3.8.11
os_name Linux
os_version 4.4.59+
arch aarch64
timezone Europe/Paris
Home Assistant Community Store
GitHub API ok
Github API Calls Remaining 4951
Installed Version 1.15.2
Stage running
Available Repositories 877
Installed Repositories 4
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Lovelace
dashboards 2
resources 2
error /volume1/@appstore/homeassistant/var/config/ui-lovelace.yaml not found
views 2
mode storage
@metbril
Copy link

metbril commented Dec 30, 2021

Bas's frontend automations use a different set of theme files.

https://github.com/basnijholt/home-assistant-config/blob/ae69265f1b9bb904e884e985b99d5d2cbaa77f82/automations/frontend.yaml#L33

Try this instead:

automation:
  - alias: "Frontend: change theme"
    trigger:
      - platform: state
        entity_id: input_select.theme
      - platform: state
        entity_id: input_boolean.dark_mode
      - platform: state
        entity_id: input_boolean.theme_alternative
      - platform: homeassistant
        event: start
    action:
      - service: frontend.set_theme
        data:
          name: >
            {% set name = states("input_select.theme") -%}
            {% set mode = "dark" if is_state("input_boolean.dark_mode", "on") else "light" %}
            {% set suffix = "-alternative" if is_state("input_boolean.theme_alternative", "on") else "" -%}
            ios-{{ mode }}-mode-{{ name }}{{ suffix }}

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