New Version!
New firmware version (1.20) with MQTT support has been deployed.
Change Log (1.19)
- Recent versions of Home Assistant’s internal MQTT broker users protocol version 3.1.1 which expects a different handshake from the client and rejects the connection otherwise. The new version of firmware alternately tries to connect using protocol v3.1 and v3.1.1 until succeeds.
- Added light brightness sensor in case somebody wants to use in automation or just for reporting
- Implemented device configuration via MQTT calls with JSON payloads
- Updated payload formats for some of the calls
- Sensor reads parameter deprecated in UI and hard-coded at 3.
Change Log (1.20)
- Fixed timeout alert
- Re-organized MQTT topics
Initial Configuration
After you confirmed in settings that your Garadget is at at v1.20 use the following process to configure MQTT connection.
- 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.
Same process can be used to re-setup the device with new WiFi network or to change any of the configuration settings without internet connection and mobile apps.
MQTT Topics
Garadget subscribes for following topics:
/garadget/{device-name}/command
Acceptable payloads:
- open - to open the door
- close - to close the door
- stop - to stop the door if in motion
- get-config - to request the config update posted to config topic (see below)
- get-status - to request the status update posted to status topic (see below)
/garadget/{device-name}/set-config
Acceptable payload is JSON with any combination of following properties:
{"rdt":num,"mtt":num,"rlt":num,"rlp":num,"srt":num,"nme":"str","mqtt":num,"":"str","mqpt":str,"mqus":"str","mqto":num}
- 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. If cloud connection enabled, at reboot this value will be overwritten with the one saved in cloud via the apps
- 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
Garadget publishes to the following topics
/garadget/{device-name}/status
At the boot, reconnect, when status changed or when requested with the get-status command (see above). The payload is the JSON like this:
{"status":"str","time":"str","sensor":num,"bright":num,"signal":num}
- status - status of the door (open/closed/stopped)
- time - time in status (10s, 20m, 15h, 10d etc)
- sensor - reflection rate (0-99)
- bright - ambient light brightness (0-99)
- signal - WiFi signal strength in dB e.g. -40
/garadget/{device-name}/config
At the boot, reconnect, when configuration changed or when requested with the get-config command (see above). The payload is the same as that of get-config command but with additional read-only properties:
- sys - Particle system firmware version
- ver - Garadget firmware version (1.19)
- id - Garadget/Particle device ID
- ssid - WiFi access point (network) name
Below is the Home Assistant configuration code that seems to work for me. I’m poking at it for only few days so anybody with experience is welcome to suggest improvements (icons, etc).
create cover in configuration.yaml
cover:
- platform: mqtt
name: "Garage Door"
command_topic: "garadget/Home/command"
state_topic: "garadget/Home/status"
payload_open: "open"
payload_close: "close"
in sensors.yaml linked from configuration.yaml with sensor: !include sensors.yaml
- platform: mqtt
name: 'Garage Door'
state_topic: 'garadget/Home/status'
value_template: '{{ value_json.status }}'
- platform: mqtt
name: 'Garage Brightness'
state_topic: 'garadget/Home/status'
unit_of_measurement: '%'
value_template: '{{ value_json.bright }}'
in automations.yaml periodically request the status to keep the brightness updated
- alias: 'Update Garage Brightness'
trigger:
platform: time
minutes: '/2'
seconds: 00
action:
service: mqtt.publish
data:
topic: "garadget/Home/command"
payload: "get-status"
Your feedback and suggestions are very welcome.