Another garage door topic - help in HA..please

Hi everyone

I was able to add d1 mini, magnetic sensor/switch and dual relay (one for up and other for down), using tasmota.
All of the above are seen as switchs. up and down with 1 sec relay activation’s, and magnetic sensor will report switch ON when garage is closed.

Everything is OK in HA and MQTT, but they are displayed as switchs and not cover.
I need to change this to cover, so google assistant can also see this as cover.

How do I convert 2 switches as cover up and down, and magnetic switch as status sensor?
POWER1 - Up
POWER2 - Down
POWER3 - Magnetic sensor (only need status on this one)

Do I have to convert this with scripts and make call services: MQTT publish and send “ON” to topic /PortaGaragem/POWER1-2 = ON and ask for stat/PortaGaragem/POWER3 ?

Is there a simple way to do this?

Can I use the cover function? How?

I really need help on this one!

Regards
Goahead

Have you looked at this?

Yes I did.
I am still confused :frowning:

dammit…cannot have 2 command_topic bellow 1 name only…

cover:
  - platform: mqtt
  - name: "garagedoor_mqtt"
    command_topic: "cmnd/portagaragem/POWER1"
    payload_open: "ON"
    payload_close: "null"
    payload_stop: "null"
    command_topic: "cmnd/portagaragem/POWER2"
    payload_open: "null"
    payload_close: "ON"
    payload_stop: "null"
    state_topic: "cmnd/portagaragem/POWER3"
    state_open: "OFF"
    state_closed: "ON"
    optimistic: false
    retain: false

How can I define 2 different command topics for same garage door name?

Another ideia came to my mind:

Can payload_open and payload_close call for services?
I could create 2 scripts for open and close, and call them inside payload:

cover:
  - platform: mqtt
  - name: "garagedoor_mqtt"
    payload_open:
      service: script.garage_door_open
    payload_close:
      service: script.garage_door_close
    payload_stop: "null"
    state_topic: "cmnd/portagaragem/POWER3"
    state_open: "OFF"
    state_closed: "ON"
    optimistic: false
    retain: false

I could also use:

cover:
  - platform: template
    covers:
      garage_door:
        device_class: garage
        friendly_name: "Garage Door"
        value_template: "{{ states('sensor.garage_door')|float > 0 }}"
        open_cover:
          service: script.open_garage_door
        close_cover:
          service: script.close_garage_door

…but i dont know how to create the value_template, to get the status of POWER3, to receive the status “open” or “close” from the ON/OFF state.

In need of help

Kind regards
Goahead

I think I got it with this:

cover:
  - platform: template
    covers:
      garage_door:
        device_class: garage
        friendly_name: "Garage Door"
        value_template: "{{ 'Closed' if is_state('switch.portaogaragemsensor', 'on') else 'Open' }}"
        open_cover:
          service: script.open_garage_door
        close_cover:
          service: script.close_garage_door

image

Dont have stop button (dont need it), but still need to display status by different mdi and with text.

I am getting there…

1 Like