using a browser_mod.javascript service hass-browser_mod/documentation/services.md at 7cb63451d15970f63e1cdd14c535af928a1c5dea Ā· thomasloven/hass-browser_mod Ā· GitHub
I am not sure how to do what I āneedāā¦
please help me out if you can. I basically want to refresh the Yaml of the frontend, like the top right menubar item does when clicking Refresh.
In have a toast created in an automation with this action:
automation:
- id: alert_yaml_error
max_exceeded: silent
triggers:
trigger: event
event_type: system_log_event
event_data:
name: annotatedyaml.loader
variables:
message: >
{{trigger.event.data.message}}
name: >
{{trigger.event.data.name}}
# conditions:
# condition: template
# value_template: >
# {{'uix_foundries' in trigger.event.data.message}}
actions:
# - variables:
# message: >
# {{trigger.event.data.message}}
# name: '{{trigger.event.data.name}}'
- action: persistent_notification.create
data:
title: '{{name}}'
message: '{{message}}'
- action: browser_mod.javascript
data:
code: |
document.querySelector("home-assistant").dispatchEvent(
new CustomEvent("hass-notification", {
detail: {
message: "{{ (name ~ ': ' ~ message) | replace('"', '\\"') }}",
duration: -1,
dismissable: true,
action: { text: "Reload Yaml", action: lovelace_reload }
},
bubbles: true,
composed: true
})
);
and the Toast seems to show alright
However, if I click that button before having fixed the yaml, I expect the toast to popup once more, and in this case, it disappears.
as you can see I also create the persistent notifications for the same trigger, and that also isnt updated when I click the Reload Yaml. It is updated when clicking Refresh in the menu bar item
so, is this not the right command, or should I use different syntax?
maybe the command isnt even functional anymore because of Frontend changes and no more using Lovelaceā¦
in which case it should probably not even be listed in BM documentation anymore 
but, first checking if this is a user error, so, any help appreciated
edit
stock Dashboard does have this button
so if I could execute the same action of that button Id be happy.
is this it? frontend/src/panels/lovelace/ha-panel-lovelace.ts at b0b2d842874ce1e5193e8562f9cda2a3a344cb5d Ā· home-assistant/frontend Ā· GitHub