Garage Sensor Value to Text

I have looked around for this and each time response has been different on how to do what I want to do, and most of the time the code that was provided throws errors when I try and adjust it for what I need.

I am using a FortrezZ MIMO device to monitor my Garage Door and be able to Open/Close the Garage Door. Currently I am using an Entry Card to display the Sensor Data, which just outputs a number. I know which value means closed and what is opened. I would like to make it so that it says Open or Close, or it changes the Icon to show Open or Closed.

I have seen Binary Sensor, Sensor, and a couple other Template ways to do this, but none seem to work (either the code has errors or I am not sure how to use it with a card). I am looking for help/advice on how I can convert the value into a Text or Icon that I can use with an Entity Card or even a Button Card (where it updates to show the current status and when I press it, the door will Open, Close, Stop, etc…).

The Entity is “sensor.garage_door_general_purpose” and if it shows a Value of “4.0” the Garage is closed. If it is higher than 4.0, it is open. My Button Card uses “switch.garage_door_3” to trigger the Garage with a Toggle Action.

I don’t have too many advance add-ons (like Card Mod I think it is), so if that is needed please let me know.

Thank you.

You should make a template cover.

cover:
  - platform: template
    covers:
      garage_door:
        device_class: garage
        friendly_name: "Garage Door"
        value_template: "{{ states('sensor.garage_door_general_purpose')|float > 4 }}"
        open_cover:
          - service: switch.turn_on
            target:
              entity_id: switch.garage_door_3
          - delay: 1
          - service: switch.turn_off
            target:
              entity_id: switch.garage_door_3
        close_cover:
          - service: switch.turn_on
            target:
              entity_id: switch.garage_door_3
          - delay: 1
          - service: switch.turn_off
            target:
              entity_id: switch.garage_door_3
1 Like

Thank you for the information and code.

I had split off my Templates to a templates.yaml, but the code has issues when I put it in there. It works fine if I have it in configuration.yaml. Guess that is something I need to look into why it is having issues within the templates.yaml file.

This is not part of the template integration. It is a platform in the cover integration. If you want you can put all your covers in a seperate file by putting this in your configuration.yaml file:

cover: !include covers.yaml

Then put the config in my post above in this file, without the first line (cover:).

Just because configuration for an integration includes a template or uses a template platform does not mean it is part of the template integration.

The integration is always the word hard up against the margin. In this case cover:

1 Like

Ah, I see. That makes more sense. Thank you for clarifying that.

I did get a chance to test it, but even with the door opened, it showed closed. I am guessing the Value Template affects the first item if true and then uses the second item if false. It also seemed like the value changed from 4 to 5 last night (might be heat related due to the mounting), so I adjusted it to be float > 5 instead.

Interesting, it is working as expected now. Not sure why it was acting up earlier. I did move it to it’s own file and did the include as you mentioned and it seemed to start working after that. Strange.

All well, it is working. Thank you for all the help.