[RELEASE] Garadget MQTT device handler

Thanks to @kevin for the inspiration and @hovee for emotional and development support...I wrote a MQTT specific device handler for the garadget. This DH will expose all of the values into a Garage door device and allow you SET parameters of the Garadget from Hubitat.

States and Commands:

Door: Open/Close/Opening/Closing/Stopped
Contact: Open/Closed
Stopped: true/false
Commands: open/close/stop

image

image

Garadget Setup

To setup MQTT on your Garadget, go here:

Cliff Notes
  1. Put your unit into listening mode: press and hold โ€œMโ€ button for about 3 seconds until LED starts blinking dark blue.
  2. Connect any WiFi enabled device to PHOTON-XXXX access point.
  3. Open http://192.168.0.1/ in the browser and (re-)configure WiFi connection and MQTT settings
  4. Submit to save. The device will reconnect to your WiFi network.

This process can be repeated anytime if necessary. Internet connection is not required.
Note that either or both Cloud and MQTT links can be used.

NOTICE - READ THE FOLLOWING PARAGRAPH :

Setting the Topic ID value in the Garadget is NECESSARY but IRRELEVANT. First that ID must NOT contain spaces. When the garadget first connects to the broker it will create a topic with that name...however it will NOT continue to use it. It will then create a topic with the device name (door name) and that is the topic name you want. More details about this can be found on the garadget forum. This was as of firmware 1.2

MQTT Broker

Summary

You will need a MQTT broker setup. It can be on a raspi or pretty much any platform can run one. I personally use a docker container on my NAS. Mosquitto MQTT is pretty popular and good place to start.
https://mosquitto.org/

If you are new at all this MQTT stuff I highly recommend MQTT Explorer as it will allow you to connect to your broker and see what's going on.
http://mqtt-explorer.com/

Don't forget after you get your Garadget connected to the broker give it at least one open or close as that will force it to communicate with the broker. Again you want to see your Garadget Garage door name show up in your MQTT broker. This is why MQTT Explorer is handy. Once you see that name in your broker, then create the Virtual device and assign it this Device Handler. Should be pretty easy after that.

INSTALL

Summary

Once you have your Garadget connected to your MQTT Broker and you are actively seeing changes when you open/close the door, then you can move to installing the Device Handler code and getting it setup in Hubitat.

Install the device handler code manually or use HPM (link below) to install the Device Handler.
Go into Devices and create a "Virtual Device" then assign the DH you installed above to it.

image

Then click "Save Device"

You should now see additional settings:

Fill out your Door name (see note above), MQTT Broker IP address, port and username/password if you set one. Then click "Initialize" above and it should connect. At that point you can adjust settings to your preferences. All settings are replicated from the Garadget App so look there for definitions of the settings if they aren't making sense.

CODE

DEVICE HANDLER CODE: (This is also available in Hubitat Package Manager)

Summary

hubitat/garadgetmqtt.groovy at master ยท jrfarrar/hubitat ยท GitHub

Version Notes

Summary

V1.4.1 on github and HPM

  • log tweaking
  • turn off debug logging after 60 min
  • code efficiency for scheduled refreshes

V1.4.0 on github and HPM

  • added scheduler for refreshing of stats
  • added scheduler for checking for lost connection to MQTT broker
  • streamlined logging and made more consistent

V1.3.2 on github and HPM.

  • implemented changing of Garadget MQTT Broker IP and Port (Be careful here...)
  • refresh preferences upon saving and getting config
  • validation of config data
  • code documentation
  • added "stop" command
  • other small stuff

CAUTION - This driver allows you to change the IP address and Port that your garadget connects to. If you change this IP or PORT and hit save or configure those changes will be sent and saved to the garadget. If they are not correct you will have to follow the instructions above to locally connect to the garadget and change them back to what you want.

More Details

Summary

State Variables:
sys: Particle Firmware Version
ver: Garadget Firmware Version
id: Garadget/Particle device ID
ssid: WiFi SSID name Garadget is connected to

States:
Signal: Wifi Signal Strength
Sensor: Reflection strength from laser for contact sensor
Illuminance/Bright: Ambient light measured by Garadget
Stopped: True/False whether the door was stopped while trying to close
Time: length of time since last action (open/closed/stopped)

Garadget nomenclature details
rdt - sensor scan interval in mS (200-60,000, default 1,000)
mtt - door moving time in mS from completely opened to completely closed (1,000 - 120,000, default 10,000)
rlt - button press time mS, time for relay to keep contacts closed (10-2,000, default 300)
rlp - delay between consecutive button presses in mS (10-5,000 default 1,000)
srt - reflection threshold below which the door is considered open (1-80, default 25)
nme - device name to be used in MQTT topic.(currently broken in Garadget firmware 1.2 - it does not honor it. It uses default device name.)
mqtt - bitmap 0x01 - cloud enabled, 0x02 - mqtt enabled, 0x03 - cloud and mqtt enabled
mqip - MQTT broker IP address
mqpt - MQTT broker port number
mqus - MQTT user
mqto - MQTT timeout (keep alive) in seconds

6 Likes

It works really well! Thank you so much for making this. Great stuff!

1 Like

This has been added to Hubitat Package Manager

2 Likes

Ok, so I had to do some quick learning about MQTT for this, but I was determined.

I've got eclipse-mosquitto running in a docker container on my media server, and it works enough to open and close the door, but as far as HE is concerned, the door is always open.

The Garadget app reflects the correct state.

I used this how-to as a guide for getting the MQTT broker running (I use portainer, so there was a bit of guessing as I'm beyond new to docker): putting-something-in-front-and-hashing-out-com-domain-to-get-past-no-link-blocks-blog.feabhas####/2020/02/running-the-eclipse-mosquitto-mqtt-broker-in-a-docker-container/

This is a current status with the door closed:

Current States

  • bright : 73
  • contact : open
  • door : open
  • sensor : 1
  • signal : -47
  • stopped : false
  • time : 2m

And the reflection threshold is at 25 (default).

Other info:

State Variables

  • ver : 1.20 - Garadget firmware version
  • sys : 0.6.4 - Particle Firmware Version
  • version : 1.4.1 - Garadget MQTT Device Handler version

Help?

can you use MQTT explorer or similar and show me what you are seeing in your broker?

MQTT Explorer as it will allow you to connect to your broker and see what's going on.

Just wanted to stop by and say this is GREAT. Thank you.

1 Like

Download the Hubitat app