Garage Door Dynamic Icon

Hi @SteveDinn thanks for sharing this! - This has been on my todo for a very long time.

Would you mind sharing your conditions? that I seem to be missing?
Might improve my stability issues :slight_smile:

I am using the HA App and get notification through that works really well

They were in the template cover that I originally posted:

There is a condition in both the “open_cover” and “close_cover” scripts. It’ll only run “open_cover” if the state of the MQTT cover is “closed” and it’ll only run “close_cover” of the state of the MQTT cover is “open”. This way, you’ll never be able to press the down button and have the door go up, and vice versa, despite them being the same MQTT messages.

Of course, this all depends on the state of your MQTT cover being reported correctly. i.e., that reed switch problem you were having will need to be worked out.

Ok then I really don’t think I am missing anything, am I ?

  - platform: mqtt
    name: garagedoor_mqtt
    command_topic: cmnd/Sonoff_SV_Garage/POWER
    payload_open: "ON"
    payload_close: "ON"
    payload_stop: "ON"
    state_topic: cmnd/garagestate/POWER2
    state_open: "ON"
    state_closed: "OFF"
    optimistic: false
    retain: false

  - platform: template
    covers:
      garagedoor:
        friendly_name: Garage Door
        value_template: '{{ is_state("cover.garagedoor_mqtt", "open") }}'
        icon_template: '{% if is_state("cover.garagedoor_mqtt", "open") %}mdi:garage-open{% else %}mdi:garage{% endif %}'
        open_cover:
          - condition: state
            entity_id: cover.garagedoor_mqtt
            state: 'closed'
          - service: cover.open_cover
            entity_id: cover.garagedoor_mqtt
        close_cover:
          - condition: state
            entity_id: cover.garagedoor_mqtt
            state: 'open'
          - service: cover.close_cover
#        stop_cover:  
#            service: cover.stop_cover
#            entity_id: cover.garagedoor_mqtt

I did a telnet with Putty to HA. and logged with root but I couldn’t execute your command?
mosquitto_sub -v -h localhost -p 1883 -u [username] -P [password] -t ‘#’

Maybe I should install the internal console plugin? or replace it with this?
the mqqt and built in webservice?

Yeah, that looks right. I thought that in one of your posts, it didn’t have those conditions.

Hrm…I’m not sure how you have your MQTT set up then. I don’t use the broker that comes with HA. I didn’t like that all the MQTT devices I had would lose contact every time I restarted HA. What error did it give you running that command?

I get a “Error: Address not available” ?

So what MQTT are you using? I guess it wouldn’t be to hard to change it?
I am using the “standard one” Mosquitto broker 4.1 An Open Source MQTT broker.

I assumed that you were running mosquitto on the same machine as Home Assistant. You can replace “localhost” with whatever you’re running mosquitto on. The standard port for MQTT is 1833. If it is the same machine, try using 127.0.0.1 instead of “localhost”.

I am running on the same raspberry new + version

And trying IP address and local gets me:
core-ssh:~# mosquitto_sub -v -h 127.0.0.1 -p 1883 -u user -P password -t ‘#’
Error: Invalid subscription topic ‘‘#’’, are all ‘+’ and ‘#’ wildcards correct?
Use ‘mosquitto_sub --help’ to see usage.

Ha! It looks like perhaps this forum changed standard single quotes into some fancy left-hand and right-hand single quotes. Try typing single-quote hashtag single-quote manually.

But yes, the # is just a wildcard for everything.

AHA! Yes that was it…

Please take a look at my output. (It goes crazy when I press the close button)

I really dont understand it, it opens right away, but the closing seems like it overloads it… and if you just wait then it will close (Pressing again will make it take even longer, which you really want to do because you think it hasent received any signal to close.)

Again thanks for spending your valuable time helping me out!

Wow. I have no idea here. I press the up or down button on the interface, and I get one instance of “cmnd/GarageDoor/POWER ON” when viewing my MQTT broker. Seems like something is causing an awful lot of command topics to get published. The “stat/Sonoff_SV_Garage/RESULT” “stat/Sonoff_SV_Garage/POWER” topics are just the sonoff SV responding with the current state of POWER.

The only thing that should be sending those cmnd topics is Home Assistant itself, so what’s in your HA log when all this is happening?

Tue Mar 19 2019 17:48:43 GMT+0100 (Central European Standard Time)

Not passing an entity ID to a service to target all entities is deprecated. Update your call to cover.close_cover to be instead: entity_id: all

Doesn’t make any sense I don’t have any record with this in my configuration

019-03-19 17:25:36 WARNING (MainThread) [homeassistant.helpers.service] Not passing an entity ID to a service to target all entities is deprecated. Update your call to cover.close_cover to be instead: entity_id: all
2019-03-19 17:25:36 WARNING (MainThread) [homeassistant.helpers.service] Not passing an entity ID to a service to target all entities is deprecated. Update your call to cover.close_cover to be instead: entity_id: all
2019-03-19 17:25:36 WARNING (MainThread) [homeassistant.helpers.service] Not passing an entity ID to a service to target all entities is deprecated. Update your call to cover.close_cover to be instead: entity_id: all
2019-03-19 17:25:36 WARNING (MainThread) [homeassistant.helpers.service] Not passing an entity ID to a service to target all entities is deprecated. Update your call to cover.close_cover to be instead: entity_id: all
2019-03-19 17:25:36 WARNING (MainThread) [homeassistant.helpers.service] Not passing an entity ID to a service to target all entities is deprecated. Update your call to cover.close_cover to be instead: entity_id: all

So its this line

    close_cover:
      - condition: state
        entity_id: cover.garagedoor_mqtt
        state: 'open'
      - service: cover.close_cover   <------

Looks like that’s it. Specify

entity_id: cover.garagedoor_mqtt

and you should be good.

Sorry I am not following you we already have that defined in the line above?

close_cover:
  - condition: state
    entity_id: cover.garagedoor_mqtt   <-----
    state: 'open'
  - service: cover.close_cover

That’s in the condition. Here’s what the full close_cover section should look like:

    close_cover:
      - condition: state
        entity_id: cover.garagedoor_mqtt
        state: 'open'
      - service: cover.close_cover
        entity_id: cover.garagedoor_mqtt   <------ You were missing this line

Thanks Steve

So sorry I didn’t catch that in the beginning of this, and we spend so much time over onr missing line…
On the positive side you have learned me allot about getting logs from MQTT and more :smiley:
THANKS!

I do see a lot of devices losing contacts in the logs, and I have had one or two false alarm saying that someone opens the garage door when nobody’s home (Scary false alarms!) - So what MQTT did you get that could handle all your devices? (Just curious not going to mess with this for some time now! )

This is much more like it…
stat/Sonoff_SV_Garage/RESULT {“POWER”:“ON”}
stat/Sonoff_SV_Garage/POWER ON
stat/Sonoff_SV_Garage/RESULT {“POWER”:“OFF”}
stat/Sonoff_SV_Garage/POWER OFF
cmnd/garagestate/POWER2 ON
cmnd/Sonoff_SV_Garage/POWER ON
stat/Sonoff_SV_Garage/RESULT {“POWER”:“ON”}
stat/Sonoff_SV_Garage/POWER ON
stat/Sonoff_SV_Garage/RESULT {“POWER”:“OFF”}
stat/Sonoff_SV_Garage/POWER OFF
cmnd/garagestate/POWER2 OFF
tele/Sonoff_SV_Garage/LWT Offline

The going offline could be due to the version of Tasmota you’re running. There were some versions released with a core library that was kind of buggy. See this thread for details:

https://community.home-assistant.io/t/sonoff-tasmota-started-regularly-showing-unavailable-on-home-assistant

Incidentally, a new release of Tasmota just came out today and they reverted back to the solid version of that buggy library.

Great I will try updating one or two!

@SteveDinn oh forgot to ask how are you running HA? Raspberry, Docker? and what MQTT did you ses that you think is better?

I use Raspberry because of Hassio to much trouble using another platform, but maybee that have changed?

I’m running Home Assistant on Ubuntu in a python virtual environment. I have a media server that’s on all the time anyway, and running Home Assistant on it is hardly taxing, and still many times faster than a Raspberry Pi. I don’t have any sense of what might be better because this is all I’ve ever done.

I used to use the MQTT broker provided by HA, but I moved to a stand-alone Mosquitto broker, so that it didn’t shut down when I restarted HA. Thanks to Tasmota’s rules, I have some ‘automations’ that can run even in the absence of Home Assistant.

Hi @SteveDinn

I have finally moved away from Raspberry and I am running HA on a VM on a Unraid server!
What a difference!

Since your help troubleshooting the garage door setup it’s been Rock Solid! - No false openings
I also reflashed all of my Tasmota to the one based on the pre-2.6 core
(I highly recommend it if you have any disconnect problems)
http://thehackbox.org/tasmota/

But I just wanted to hear if you use your Garage setup in Google Assistant?
Because it seems that the only way to get that working is to create a “Switch” for the garage opener
And I really don’t want to go down that road again!

Sofar if I try to expose it to Google assistant:

google_assistant:
  project_id: !secret gass_projectid
  api_key: !secret apikey
  exposed_domains:
    - sensor
    - script
    - switch
    - light
    - climate
    - cover
    - media_player
    - scene    
    - group
    - fan
  expose_by_default: false
  entity_config:    
        cover.garagedoor:
          name: Garageport
          expose: true
          room: Garage
          aliases: Garageport

I only get the garagedoor_mqtt

Witch doesn’t do anything in google assistant

Anyway I hope your doing well
Cheers

1 Like