Need some help with my MQTT Covers. I originally just had the one (the first one below), but I’m now testing an MQTT double garage for my parents house. I added the two extra mqtt platforms to my cover.yaml file but when I try to restart HASS it fails and the error message is as follows:
Jan 27 01:37:04 raspberrypi systemd[1]: Started Home Assistant.
Jan 27 01:37:05 raspberrypi hass[32389]: ERROR:homeassistant.util.yaml:while parsing a block mapping
Jan 27 01:37:05 raspberrypi hass[32389]: in “/home/redwngsrul/.homeassistant/cover.yaml”, line 14, column 3
Jan 27 01:37:05 raspberrypi hass[32389]: expected block end, but found scalar
Jan 27 01:37:05 raspberrypi hass[32389]: in “/home/redwngsrul/.homeassistant/cover.yaml”, line 26, column 17
Jan 27 01:37:05 raspberrypi hass[32389]: Config directory: /home/redwngsrul/.homeassistant
I custom made my garage board and the arduino code for the NodeMCU board that runs my garage controller. Without details on your board and the code associated, I really can’t speculate on why your relay doesn’t toggle.
The command_topic is the topic that the payload is sent to. So when you click the open/close button, it sends a “1” as a payload to /garage/gpio/14.
Your command topic leads me to believe that you have a relay connected to your raspberry pi, am I correct?
I’m seeing some discrepancies in your code though.
I may be out of context, but you probably shouldn’t use retain: true. I would suggest making that false. For my garage, when I press the physical garage opener button (that’s wired to the garage), it simply closes a switch that passes the 24Vdc to the door activate input and moves the door. So for my Wifi Hass garage control board, I have, in essence, one relay on the board that parallels with the physical switch. If I hit the front end button for Open, Close, or Stop, they all perform the same function. They activate the relay to simulate a garage opener button press.
FYI I only have a single garage door. I show 3 up in my previous posts above because I was test building another double-garage controller for my parents house.
I’m using ESP Easy R148 and I have two switches, one on GPIO12 as a sensor for my garage door and another on GPIO14 to drive the relay. The relay needs to turn on for one second then off again to emulate the integrated garage controller. The GPIO12 switch is called ‘reed’ and is set to 'Push Button Active Low to toggle and the GPIO14 switch is called ‘relay’. I’ve now cracked it and below is rule I applied to turn the relay off after 1 second. The board is a NodeMCU v3 but I’ll be using a low voltage Sonoff in the production unit.
on System#Boot do
gpio,14,0 // Prevent relay turning on during boot
endon
on relay#state do
if [relay#state]=1
timerSet,1,1 // 1 second timer
endon
on Rules#Timer=1 do
gpio,14,0 // Turn off relay
endon
If I send a MQTT message to /devicename/gpio/14 with a payload of 1, the relay turns on for one second which is great! I have the Value Name 1: for the ‘reed’ switch set to state so that when the door is closed, I get /garage/reed/state with either 1 or 0 (opened or closed). I’m now trying to figure out how to use ESP Easy rules to publish ‘open’ or ‘closed’ when the reed switch changes state. So far no luck.
Sorry, I’m not familiar with ESPEasy or the syntax of your code. I did Google “ESPEasy MQTT Publish” and found some information. Perhaps these links may help you.
You don’t necessarily have to publish the words open or closed. The code you posted above from your cover configuration is looking for a 1 or a 0 for the state anyway. So 0 would be open and 1 would be closed, according to your yaml above. Make your ESP publish these numbers and the yaml will translate accordingly.