Detect if the phone is charging wirelessly

Hi I want to have an automation that turn on and off my lights if it is charged 100%. But only if it is charging wirelessly. I’m aware that you can see it in the section of the entity sates but I don’t know how to detect that to put it into an automation.

Something like that:

- id: 'charging'
  alias: charging
  description: ''
  trigger:
  - entity_id: sensor.phone_battery_state
    from: discharging
    platform: state
    to: charging
  condition:
  - condition: template
    value_template: '{{ is_state_attr(''sensor.phone_battery_state'', ''charger_type'',
      ''wireless'') }}'
  action:
  - data:
      message: works
    service: notify.mobile_app_phone

Change tha action part to fit yours.

I only had to change the sensor name for the template to walk. Thank you

Hi, thanks for the solution!
Sorry if I’m a bit noob in HA.
Can I ask, why the double ’ . I keep seeing that but don’t understand reason or some documentation on the syntax :frowning:

On another note, would the condition part also work with something like:

condition: state
entity_id: sensor_phone_battery_state
state: 'charger_type: wireless'

Would this work? If not, why?