Agreed though this started as a WIP post so it's more of a stream of consciousness for willing testers until we reach a point where it works well for most and is easy to set up for all.
And this post will be a stream of consciousness as well as I regained familiarity about that piece of code.
UPDATE: I pushed 0.9.7 through HPM. Please update, I removed a lot of code we didn't need anymore from the garaget sample code I used to get started.
I did incorporate the code fix from @GuyMan
Next update: Child devices (once I understand how to make them work
Main MQTT topic
- a ratgdo MQTT device publishes and consumes its messages in the following topic:
{MQTT Topic Prefix}{Device Name}
- these are the two fields of the same name configured in the WebUI for the ratgdo device (not the Hubitat device)
HA Discovery (sets up State Variables in the Hubitat device)
- The ratgdo device will advertise itself to HomeAssistant in the
homeassistant/cover/{device-name}
topic with a config message that tells us the device supports cover (i.e. roller shutters, blinds, and garage doors)
- It also (for my device) advertises Light & Obstruction (binary sensor in HA).
My driver today subscribes to that topic (only cover right now) and outputs the following in the log "Got Home Assistant Discovery message" when it does (when the Hubitat device is Initialized or the ratgdo itself is rebooted).
If the message deviceName matches our Hubitat Device name, it will use the content of that message to set up Stave Variables such as the: unique_id, configuration, model, manufacturer, sw_version
. This is cute and helpful information but the homeassistant messages do not affect the device operation in Hubitat today.
They might be helpful in the future to set up child devices when I move to that setup.
Hubitat
- In the Hubitat device configuration, the ratgdo Door Name(Topic name) must be set to the same value as the
Device Name
in the ratgdo webUI
- For the current Hubitat driver to work, the {MQTT Topic Prefix} in the device web UI has to be set to
ratgdo/
. I can make that configurable in the future but it is not today.
- Reminder, the device will read and publish from/to topics that start with
{MQTT Topic Prefix}{Device Name}
(WebUI references) and the Hubitat Device driver will subscribe and publish to the same topics i.e. ratgdo/${doorName}/
- the topic suffixes are status/door, status/lock, status/light, status/availability, status/obstruction
Action
Light Example
When in the Hubitat Device you click on "On" (for the light), it writes to the ratgdo/{ratgdo Door Name(Topic name)}/command/
the command light:"on"
The device then produces a message in ratgdo/{ratgdo Door Name(Topic name)}/status/
that says light=on
.
When in the Hubitat Device you click on "Open" (for the door), it writes to the ratgdo/{ratgdo Door Name(Topic name)}/command/
the command door:"open"
In the Info level log you'll see something like this:
Garage Door: Incoming MQTT Status via prefix/status/light/ : off
Open Example
The device then produces a message in ratgdo/{ratgdo Door Name(Topic name)}/status/
that says door=opening
then door=open
.
In the Info level log you'll see something like this:
Garage Door: Open command sent...
Garage Door: Incoming MQTT Status via prefix/status/door/ : open
Inversely when you trigger closing in Hubitat, the device will produces a message in ratgdo/{ratgdo Door Name(Topic name)}/status/
that says door=closing
then door=closed
.
Closing Thoughts
@erik.tank , @michicago - please update to the latest and look at your MQTT explorer and see if those command and status messages are being produced in the same one topic root (versus produced in one and subscribed/consumed in another)
Do not change the Home Assistant Discovery Prefix, leave it as homeassistant
. It doesn't affect the operation of the Hubitat Driver other than preventing the state variables to be set.
To help further please provide a screenshot of your Hubitat device preferences and your ratgdo web config.
Remember that the Topic Prefix (in the WebUI for ratgdo) HAS TO BE ratgdo/
right now and that the Device Name (in the WebUI for ratgo) has to match the ratgdo Door Name(Topic name) in the Hubitat device configuration.