Smartphone wireless charging is not triggering template

Hi there,
please be nice to me, I’ve only been playing with HA for six months and I want to understand the system step by step.
I’m currently trying to create an automation where the trigger is the smartphone on the wireless charger. In the log I can see the charging type changes to “wireless” but the automation is not triggered. It should only activate a light scene. Can someone tell me what’s wrong with the trigger? I looked at other automations in the community, which also look exactly like this

- id: '1640167054443'
  alias: Night mode
  description: ''
  trigger:
  - platform: template
    value_template: "{{ is_state_attr('sensor.sm_g950f_charger_type', 'wireless') }}"
  condition: []
  action:
  - scene: scene.wz_gaming_orange
  mode: single

Have you tried pasting this in to developer tools, template section to check if it renders correctly?

The sensor you use has no attribute for the charger type, it already is the charger type
So:

{{ is_state_attr('sensor.sm_g950f_charger_type', 'wireless') }}

Should be:

{{ is_state('sensor.sm_g950f_charger_type', 'wireless') }}

That should result in a true or false
Like @rossk said: Paste any code that doesnt work into the Dev tools.

Sorry for my late response
Thanks for this hint. I am new to HA and never used the developer tool before. But it seems to very helpful. It can avoid lots of issues.

1 Like