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:
To setup MQTT on your Garadget, go here:
- Put your unit into listening mode: press and hold “M” button for about 3 seconds until LED starts blinking dark blue.
- Connect any WiFi enabled device to PHOTON-XXXX access point.
- Open http://192.168.0.1/ in the browser and (re-)configure WiFi connection and MQTT settings
- 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
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.
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.
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.
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.
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.
DEVICE HANDLER CODE: (This is also available in Hubitat Package Manager)
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.
sys: Particle Firmware Version
ver: Garadget Firmware Version
id: Garadget/Particle device ID
ssid: WiFi SSID name Garadget is connected to
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