Make a Sleep sensor Template

Hello!

I wanne creat a sleep sensor template.
If my phone is connected to my Wifi and my Phone is charged wireless i wanne see the value “slapen”, if 1 of the two criteria is not met then i am “wakker”

This is my code in my Configuration files, what do i have wrong?

######### Slaap sensor #######

  - platform: template
    sensors:
      erik_slapen_of_wakker:
        value_template: >-
          {% if states('sensor.samsung_erik_wifi_connection') == "FamWegerif" %}, 
          {% if states('sensor.samsung_erik_charger_type') == "wireless" %}
            Slapen
          {% else %}
            Wakker
          {% endif %}
        friendly_name: 'Erik slapen of wakker'
######### Slaap sensor #######

  - platform: template
    sensors:
      erik_slapen_of_wakker:
        value_template: >-
          {% if states('sensor.samsung_erik_wifi_connection') == "FamWegerif" 
               and states('sensor.samsung_erik_charger_type') == "wireless" %}
            Slapen
          {% else %}
            Wakker
          {% endif %}
        friendly_name: 'Erik slapen of wakker'

Damn it was that easy?:rofl:
It works, thank you!