Figuring out the automation (Solved)

I have tried to get HASS to look for humidity and turn ventilator on/off
I used automation snip off code below
I have got it go on or off by changing the filter operator but it won’t change automatically when humidity drops etc…

Can you spot something wrong on my config or advice how to debug what is happening…
for example is there way to log from service template ?

  - platform: mqtt
    name: "akwc kosteus"
    friendly_name: "akwc Kosteus"
    state_topic: "home/DHT/akwc/1/temp"
    unit_of_measurement: '%'
    value_template: '{{ value_json.Humidity }}'

  - platform: mqtt
    name: "akwc flekti"
    state_topic: "home/sonoff/akwc/1/stat"
    command_topic: "home/sonoff/akwc/1"
    qos: 0
    payload_on: "on"
    payload_off: "off"
    retain: true

  - alias: 'akwc flekti automation'
      - platform: mqtt
        topic: "home/DHT/akwc/1/temp"
      service_template: >
        {% if states.sensor.akwc_kosteus | int > 60 %}
        {% else %}
        {% endif %}      
        - switch.akwc_flekti

Are you getting temp and humidity data on the MQTT server? I think you should use an action based on service: mqtt.publish

Yes I think so, at least the group entities are updated on the view.
That was my thought also and why I wondered if there is way to log and debug from service template to see what is stored to the variables etc…


Hi @tpaivaa, try:

 {% if states.sensor.akwc_kosteus.state | int > 60 %}

You can test your templates in Dev Tools/Templates.

Thanks VDRainer,
I’ll test when I get access to my system…
Will look into the template testing over there too…

Will let you know how it goes, really appreciate your help !

yes that was just what I had to do and were after thanks again!

{{ states.sensor.akwc_kosteus }}
 <state sensor.akwc_kosteus=58.5; unit_of_measurement=%, friendly_name=akwc kosteus @ 2017-08-19T08:11:17.971290+03:00> 

and when I add state to that like so. 
{{ states.sensor.akwc_kosteus.state }}

T - Tomi