sounds good, thanks a lot for the clarification Glenn, it’s much appreciated. Still think i am missing something on the opengarage, can’t wait to get it sorted.
MQTT is the lingua franca of home automation. MQTT can be confined to the local network, and any device that speaks MQTT can be controlled by any home automation that understands MQTT. I prefer MQTT over any other protocol, I have Tasmota, Zigbee2MQTT, OpenMQTTgateway, ESPRFlink, iotlink, all which use MQTT to talk to HA. It is a simple but powerful protocol for home automation.
thanks Francis… now i understand mqtt, just can’t figure out how to get it working, lol. I only have one device that works with mqtt though, the opengarage unit.
myle, thanks for those pictures, ya i have both installed.
anyone want to have a look at my opengarge mqtt config to see if they notice anything wrong?
Have you set up any switches and sensors? Sounds like this is your next step. I don’t use open garage but I’m guessing you need a binary sensor that will tell you if the door is open or closed and whether or not there is a car in there. Then a switch to open and close it as shown above.
Since you have the integration mqtt click configure and where it says listen to topic enter #, then hit listen to topic. Make sure the opengarage is on, then open and close the garage door. If it’s all working correctly you should see a message appear on the mqtt config page.
If you post those messages we can build sensors and a switch.
basically i spun up another VM so I have a test system that i am working on so i don’t screw up my working system.
i just copied and pasted this from another thread, this is my config…
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor:
- platform: template
sensors:
garage_door_status:
friendly_name: 'Garage Door Status'
value_template: '{{states.cover.garage_door.state}}'
garage_vehicle_state:
friendly_name: "Vehicle State"
value_template: >-
{% if states.sensor.opengarage_distance.state | int == 0 %}
Disabled
{% elif (states.sensor.opengarage_distance.state | int > 0) and (states.sensor.opengarage_distance.state | int <= 80) %}
Unknown (Door Open)
{% elif (states.sensor.opengarage_distance.state | int > 80) and (states.sensor.opengarage_distance.state | int <= 150) %}
Present
{% else %}
Absent
{% endif %}
- platform: mqtt
name: "OpenGarage Distance"
state_topic: "OpenGarage/OUT/DIST"
unit_of_measurement: "cm"
cover:
- platform: mqtt
name: "Garage Door"
command_topic: "OpenGarage/IN/STATE"
state_topic: "OpenGarage/OUT/STATE"
state_open: "OPEN"
state_closed: "CLOSED"
payload_open: "open"
payload_close: "close"
device_class: "garage"
The important thing is to see if the message is being broadcast by going to mqtt–>configure and listen to #. Then open and close the door. You should see a new message almost instantly.
i am having config errors with this, i think the yaml is off somewhere, just having a look…
anyone see what’s wrong with this config?
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor:
- platform: template
sensors:
garage_door_status:
friendly_name: 'Garage Door Status'
value_template: '{{states.cover.garage_door.state}}'
garage_vehicle_state:
friendly_name: "Vehicle State"
value_template: >-
{% if states.sensor.opengarage_distance.state | int == 0 %}
Disabled
{% elif (states.sensor.opengarage_distance.state | int > 0) and (states.sensor.opengarage_distance.state | int <= 80) %}
Unknown (Door Open)
{% elif (states.sensor.opengarage_distance.state | int > 80) and (states.sensor.opengarage_distance.state | int <= 150) %}
Present
{% else %}
Absent
{% endif %}
- platform: mqtt
name: "OpenGarage Distance"
state_topic: "OpenGarage/OUT/DIST"
unit_of_measurement: "cm"
cover:
- platform: mqtt
name: "Garage Door"
command_topic: "OpenGarage/IN/STATE"
state_topic: "OpenGarage/OUT/STATE"
state_open: "OPEN"
state_closed: "CLOSED"
payload_open: "open"
payload_close: "close"
device_class: "garage"
your indentation is off here:
cover:
- platform: mqtt
name: "Garage Door"
command_topic: "OpenGarage/IN/STATE"
state_topic: "OpenGarage/OUT/STATE"
state_open: "OPEN"
state_closed: "CLOSED"
payload_open: "open"
payload_close: "close"
device_class: "garage"
thanks finity, changed but still isn’t working… i think it may be this part.
- platform: mqtt
name: "OpenGarage Distance"
state_topic: "OpenGarage/OUT/DIST"
unit_of_measurement: "cm"
What does the error for the config validation say?
validation all checks out, this is the config:
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor:
- platform: template
sensors:
garage_door_status:
friendly_name: 'Garage Door Status'
value_template: '{{states.cover.garage_door.state}}'
garage_vehicle_state:
friendly_name: "Vehicle State"
value_template: >-
{% if states.sensor.opengarage_distance.state | int == 0 %}
Disabled
{% elif (states.sensor.opengarage_distance.state | int > 0) and (states.sensor.opengarage_distance.state | int <= 80) %}
Unknown (Door Open)
{% elif (states.sensor.opengarage_distance.state | int > 80) and (states.sensor.opengarage_distance.state | int <= 150) %}
Present
{% else %}
Absent
{% endif %}
- platform: mqtt
name: "OpenGarage Distance"
state_topic: "OpenGarage/OUT/DIST"
unit_of_measurement: "cm"
cover:
- platform: mqtt
name: "Garage Door"
command_topic: "OpenGarage/IN/STATE"
state_topic: "OpenGarage/OUT/STATE"
state_open: "OPEN"
state_closed: "CLOSED"
payload_open: "open"
payload_close: "close"
device_class: "garage"
and this is what i get:
I think you are starting from the wrong direction. Before starting with config files and automations, you should understand your MQTT topics and the info shown there.
I think you need to start here:
https://www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices/
and also using MQTT Explorer (or any other mqtt client) you should subscribe to the topic OpenGarage/# and see if there are any messages/info there.
If you can’t see anything then back to square one.
Remove most of you config just keep a sensor and see if that updates or not. You don’t even need to operate the door…
When you understand your topics, you will know what’s wrong and right in your config.
Maybe your door doesn’t even publish to the same topics that you have set in command and state topic…
And not using a username, maybe it is good for testing purposes, but for a real life situation you should even enable certificates and use MQTT only on a secure channel, because it doesn’t have any checks on the payload. Just google MQTT exploits…
Cheers
Tom
just helping my daughter with some homework. will have a good read through this and try. thanks so much for your help!!
OK, I was just going by this.
and this
It wasn’t clear by what you meant by “isn’t working”.
I’ll ad to the above a bit…
when you look at MQTT explorer just subscribe to everything (#) that way even if the “OpenGarage” part is wrong you will still see every message that goes to your broker and you can adjust from there.
@xman111
or even take it a step further, try to control your garage door manually with mqtt-explorer
- send a payload open to cmd topic
- listen to state topic to see if command was understood.
Once you got it working manually, you can translate your findings into a config…
from my mqtt-explorer:
Topic: Tasmota51/cmnd/POWER
Cmd: ON
Cmd: OFF
Topic: Tasmota51/stat/RESULT
Value: {“POWER”:“ON”}
Value: {“POWER”:“OFF”}
Keep in mind the way the topics are build up can vary from system to system (and are normally configurable), it really doesn’t matter that much, as long as they are the same on both ends:
(as you can see, on my system prefix and topic are turned around)
@aceindy, thanks for that. i am just not 100% sure the opengarage is even working. i opened up mqtt explorer and pointed it to my broker and listen to everything and nothing happens. I ordered a sonoff basic so i can try a different device. My setup could be working but i only have the one device to try it with, if it isn’t working, i am screwed. I am going to go through all this again once i can try another device.
Other than in HA does everything work through the open garage app? Have you configured the mqtt settings through the open garage interface. Options–>integration–>mqtt and also turned on the mqtt notifications per the manual? If you have maybe you could screenshot it and post. It also says the what you name the device will be it’s topic.