Humidity Sensor - scripting question

Hi folks,

I just bought some humidity sensors, and they are working … now I want to add them to my dashboard. And therefore I try to adjust a script which I found for my lights:

   {% set lights = [
            states.light.licht_bad_keller, 
            states.light.schlafzimmer,
            states.light.licht_kuche,
            states.light.licht_esszimmer,
            states.switch.verstarker,
            states.switch.licht_flur_eg,
            states.switch.licht_og,
            states.light.licht_windfang,
            states.light.licht_wohnzimmer,
            states.switch.stehlampe,
            states.light.licht_paula,
            states.light.licht_ben,
            states.light.ben_lightstrip,
            states.light.licht_phil,
            states.light.licht_bad_keller,
            states.light.schlafzimmer,
            states.switch.waschkuche_switch_0,
            states.switch.smart_switch_2211026018474458080148e1e9af4919_outlet,
states.switch.smart_switch_2211027228081558080148e1e9af3423_outlet,            states.switch.smart_plug_20010836349749251h3148e1e91651fd_outlet,
states.light.shapes_49a7,
            
            ] %}

          {% set devices = [

          ] %}

          {% set lights_on = lights | selectattr('state','eq','on') | list %}
          {% set lights_name = lights | selectattr('state','eq','on') | map(attribute='name') | join(', ') %}

          {% set devices_on = devices | selectattr('state','search','(close|closed)') | list %}
          {% set devices_name = devices_on | map(attribute='name') | join(', ') %}

          {% if (lights_on | length == 0) and (devices_on | length > 0) %}
            {{ devices_name | regex_replace(',([^,]*)$',' och\\1') }} ist eingeschaltet

          {% elif (lights_on | length == 1) and (devices_on | length == 1) %}
            {{ lights_name }} und {{devices_name }} ist eingeschaltet

          {% elif (lights_on | length == 1) and (devices_on | length > 1) %}
            {{ lights_name }}, {{ devices_name | regex_replace(',([^,]*)$',' och\\1') }} ist eingeschaltet

          {% elif (lights_on | length > 1) and (devices_on | length == 1) %}
            {{ lights_on | length }} Lampen und {{ devices_name }} sind eingeschaltet

          {% elif (lights_on | length > 1) and (devices_on | length > 1) %}
            {{ lights_on | length }} Lampen, {{ devices_name | regex_replace(',([^,]*)$',' och\\1') }} sind eingeschaltet

          {% elif (lights_on | length == 1) and (devices_on | length == 0) %}
            {{ lights_name }} ist eingeschaltet

          {% elif (lights_on | length > 1) and (devices_on | length == 0) %}
            {{ lights_on | length }} Lampen sind eingeschaltet

          {% else %}
            <font color='#ffffff'>Alle Lichter sind ausgeschaltet</font>
          {% endif %}             

What I want to do is like that:

{% set sensor = [
  states.sensor.temperatur_schlafzimmer_1_humidity_sensor, 
  
  ] %}

{% set devices = [

] %}

{% set sensor_wet = sensor | selectattr('state','eq','60') | list %}
{% set sensor_name = sensor | selectattr('state','eq','60') | map(attribute='name') | join(', ') %}

{% set devices_on = devices | selectattr('state' > 60') | list %}
{% set devices_name = devices_on | map(attribute='name') | join(', ') %}

{% if (sensor_wet | length == 0) and (devices_on | length > 0) %}
  {{ devices_name | regex_replace(',([^,]*)$',' och\\1') }} appears to be damp

Can anybody help me here… ?

Cheers

You’re missing a single quote before 60'.

Dear Bill, thanks for your response…but this it not working…I don’t get any result…