Automation condition using apostroph

i’m having difficulties within automations that use the status of entities: Status can be “on” or “off”. The Developer shows simply the word on and off. In conditions the requested status is compared with the actual status using apostroph, comparing the string inclusively the apostroph. The problem i have is that the keyboard i’m using (ES españa) does not have this specific character.
To overcome i copied the string from a trace.


Here one can see that the two strings are not the same because of the type of apostrophe.

Recommendation: There shouldn’t be any apostrophe added

You don’t need to quote them, just use on and off without quotes.

That’s what i wish it would work.

If i do not enter apostrophes in the UI the YAML code does show apostrophes. In automation the status is surrounded by apostrophes → always results in “false”. See screen shots:

UI


YAML

Result (trace)

Language and locales:

  • MAC OS: Español, keyboard ES
  • HA OS: English, system locale, 24hrs, TZ Europe/Madrid
    System Health

version: core-2021.12.1
installation_type: Home Assistant OS
dev: false
hassio: true
docker: true
user: root
virtualenv: false
python_version: 3.9.7
os_name: Linux
os_version: 5.10.63-v8
arch: aarch64
timezone: Europe/Madrid

GitHub API: ok
Github API Calls Remaining: 4947
Installed Version: 1.18.0
Stage: running
Available Repositories: 995
Installed Repositories: 8

can_reach_server: ok
remaining_requests: 24

logged_in: true
subscription_expiration: January 17, 2022, 01:00
relayer_connected: true
remote_enabled: true
remote_connected: true
alexa_enabled: false
google_enabled: false
remote_server: eu-central-1-2.ui.nabu.casa
can_reach_cert_server: ok
can_reach_cloud_auth: ok
can_reach_cloud: ok

host_os: Home Assistant OS 7.0
update_channel: stable
supervisor_version: supervisor-2021.12.2
docker_version: 20.10.9
disk_total: 56.4 GB
disk_used: 20.1 GB
healthy: true
supported: true
board: rpi4-64
supervisor_api: ok
version_api: ok
installed_addons: OpenZWave (0.9.1), File editor (5.3.3), Mosquitto broker (6.0.1), Check Home Assistant configuration (3.9.0), Terminal & SSH (9.2.1), FTP (4.4.0), Node-RED (10.2.2), eWeLink Smart Home (1.2.3), Log Viewer (0.12.1), motionEye (0.16.0), SQLite Web (3.2.0), Samba share (9.5.1)

dashboards: 4
resources: 3
views: 4
mode: storage

If the UI does it that’s fine - but if you enter quotes in the box then the quotes are part of what’s required in the state.

I’d want to see the actual YAML though, not a screen capture of text.

Hi, Thanks for helping.
The screen shots are kind of “fotos”, not copy/paste data form within YAML edit.
And the execution trace shows clearly that “state” and “wanted_state” are both off but with different quotes/apostrophes: Result: false.
If i copy/paste the wanted_state string into the UI it works.

And assume that other people’s eyes work like your eyes…

i know it sounds unbelievable…: The state “on” can be tested without coded quotes. Not so the state “off”.

Because the automation has three triggers (sun +1hr +2hrs +3hrs) the action should only run once: If the switch state is “off”.