Dynamic Binary Sensor - Variable State Value

Developer Tools > Template

The purpose of the exercise is to see the values of the sensor, input number, etc.

Perfect, thanks (slowly learning), result below…

Based on the results you posted, the water temperature is currently 33.5 degrees, the input number is 32, so the template reports false because 33.5 is not less than 32.

Therefore the current value of binary_sensor.hot_tub_temp_low should be off. Can you confirm that?

1 Like

Correct, I want the binary sensor to turn on to trigger the alert if the temp is below the setpoint. I assume just change the sign from the current “<=” to “>=” to accomplish this?.

That’s what it’s currently designed to do. It turns on only when the temperature is below the input number’s value.

It’s currently off because the temperature is above the input number’s value.

Sorry you are correct, I am thinking in the opposite direction. I appreciate the help and I did learn something with the template editor that is pretty slick. Do you remember my other post from yesterday about the alerts not triggering, then I uploaded and older setup from a few days back and everything worked as it should ?. Well without touching it, other than what we worked on, the alerts do not trigger again (I did not update anything0, any magic tricks to see what is going on ?


  - binary_sensor:
      - name: "Garage Temp Low"
        state: "{{ states('sensor.garage_temp_sensor') | float(0) <= 10.0 and is_state('input_boolean.pause_alerts', 'off') }}"

  - binary_sensor:     
      - name: "Sump Level High"
        state: "{{ states('sensor.sump_level_sensor') | float(0) >= 75.1 }}"

  - binary_sensor:     
      - name: "Hot Tub Temp Low"
        #state: "{{ states('sensor.hottub_water_temp_sensor') | float(0) <= 30.0 }}"
        state: "{{ states('sensor.hottub_water_temp_sensor') | float(0) <= states('input_number.hot_tub_low_temp_alarm_setpoint') | float(0) }}"
    name: Hot Tub Low Temperature
    entity_id: binary_sensor.hot_tub_temp_low
    state: "on"
    repeat: 1
    skip_first: False
    message: Hot Tub Temperature is Low
    done_message: Hot Tub Temperature has Returned to Normal
     - mobile_app_RK_12
     - gmail

If the suggestion I made answers your original question, please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.

It appears that you have chosen to mark your own post with the Solution tag, despite the fact it contains no information about how to answer your original question (namely how to create a Template Binary Sensor that compares a sensor’s value to an input number’s value).

This choice of Solution post won’t be helpful to other users who may be looking for answers to similar questions.

I was trying to delete it and could not, sorry

  • You can only mark one post in a topic with the Solution tag.

  • If you mark a post with the Solution tag and then mark another post, the Solution tag will be automatically removed from the first post and assigned to the second one.

Ok thanks for the notes, I will remember for next time. Should I create a new post about my alert issue ?

Why not try it now in this topic given that you have clearly marked the wrong post with the Solution tag.

Ok, I think it’s good now?

Nothing has changed.

Thought you meant the other post, fixed now (or should be :slight_smile: )

Did the Template Binary Sensor in this post answer your question?

If it did, it would be beneficial to other users if you mark it with the Solution tag.

If it did not, let me know why and perhaps it can be improved.

Yes that did help and is the solution once I thought about it properly

Glad to hear it’s the solution.

So why did you choose to, yet again, mark one of your own post’s with the Solution tag?

In case the process is unclear to you, here’s the relevant guideline from the forum’s FAQ:

Sorry, got it