Mqtt cover discovery issue: Unable to parse JSON

Hi all,

This is my first time creating a topic in the community forum :).
I am currently trying to integrate my garage door into Home Assistant using an Arduino in conjuction with an ethernet board. I communicate with Home Assistant using mqtt and wanted to do this “properly” by integrating my garage door as an mqtt cover which supports discovery. My Home Assistant instance is running the Mosquitto Broker addon with discovery enabled.
The config topic is published together with its payload to Home Assistant. When listening to the config topic

homeassistant/cover/garagentor/config

I receive its payload like this:

{
	"uniq_id": "garagentor_hoermann_pro_3",
	"name": "Garagentor Hörmann",
	"dev_cla": "garage",
	"dev":{
		"mdl":"Promatic 3",
		"mf":"Hörmann"
	},
	"opt": false,
	"ret": false,
	"~": "homeassistant/cover/garagentor",
	"cmd_t": "~/set",
	"pl_open": "OPEN",
	"pl_cls": "CLOSE",
	"pl_stop": "STOP",
	"stat_t": "~/state",
	"stat_clsd": "closed",
	"stat_closing": "closing",
	"stat_open": "open",
	"stat_opening": "opening",
	"avty_t": "~/status",
	"pl_avail": "online",
	"pl_not_avail": "offline",
	"pos_t": "~/position",
	"pos_clsd": "0",
	"pos_open": "100",
	"pos_tpl": "{{value.y }}"
}

Upon first inspection, everything seems to be looking right for me and discovery even has worked once for me yesterday. However, I am now unable to get it to work. When publishing the config topic, my device doesn’t show up in the mqtt integration. When inspecting the logs I can see the following warning:

2021-05-20 18:07:22 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON garagentor: '{
"uniq_id": "garagentor_hoermann_pro_3",
"name": "Garagentor Hörmann",
"dev_cla": "garage",
"dev":{
"mdl":"Promatic 3",
"mf":"Hörmann"
},
"opt": false,
"ret": false,
"~": "homeassistant/cover/garagentor",
"cmd_t": "~/set",
"pl_open": "OPEN",
"pl_cls": "CLOSE",
"pl_stop": "STOP",
"stat_t": "~/state",
"stat_clsd": "closed",
"stat_closing": "closing",
"stat_open": "open",
"stat_opening": "opening",
"avty_t": "~/status",
"pl_avail": "online",
"pl_not_avail": "offline",
"pos_t": "~/position",
"pos_clsd": "0",
"pos_open": "100",
"pos_tpl": "{{value.y }}"
}'

The problem is that I just cannot find any error in the JSON itself. I tried getting rid of the error by throwing out element by element, but the problem just keeps persisting.

Is there anyone who can see what might be the problem here?

@DarkWarden, did you ever found a solution for the issue? I am experiencing similar one. Also, can you share how did you connect arduino to Promatic3? I have the same garage motor and would like to open the garage using bluetooth from my phone.

Tnx.

Hello @dukicn,

I never got mqtt discovery to work. As i had some ESP8266 NodeMCU lying around, I switched to ESPHome instead, which works like a charm over wifi.

I can share how I connected the NodeMCU to the Promatic 3, which should give you a hint how you can connect your Arduino to the Promatic 3. Just beware the currents and use appropriate resistors

I used optocouplers to bridge the 3,3V NodeMCU voltage to the 24V of the Promatic 3. There is one binary input (garage open or closed) and two binary outputs. You can find the promatic manual online which describes what the ports on the promatic do in detail.

The nodemcu currently gets its power from a phone charger, however I think it’s possible to power it via the promatic itself. I plan to upgrade it accordingly in the future, which also means adding some additional sensors for the garage door position.

PS: Ignore the AM2320 sensor. I just use it to get humidity levels in the garage.

@DarkWarden, thank you for the schematics. Will give it a go.

@DarkWarden , can you share the schematics or a picture on how you connected your circuit board to Promatic 3?
I have all the parts now, so would like to give it a try and verify my understanding before I burn down my garage doors :slight_smile:

Thanks

Hi @dukicn, I have updated my schematics to give a full picture how the connections are made:

I hope this helps :slight_smile:

@DarkWarden , yes, thanks a lot for this. If this doesn’t help me, nothing will :slight_smile:

Did you use output for PWM or simple switch (sorry, I never built anything with motors before, I only used switches and sensors, motors are a whole new territory for me).

I just used simple switches. Although the impulse and position outputs going to the promatic 3 do not really have a state, so you could also use the new button entities from Home Assistant 2021.21.

Edit: Just to clarify: You’re not directly controlling the motors of the promatic but only communicating with its logic board.