One other thing to check is the usb charger you are using to supply power. I had issues with mine varying by about a 1m over subsequent reads, which would cause the car in garage reading to go in and out constantly.
My 1A usb charger was not providing stable/clean/sufficient power to the unit and it was causing the problem. Replacing it with a 2A charger (despite their webpage saying 1A is fine), it fixed it straight away.
If it works for you then there’s probably no difference, but connecting HA to mine would cause the unit to intermittently freeze up and need to be reboot. If it wasn’t polling it worked fine, and moving to MQTT fixed it for me.
I’m back again and, fresh from some basic knowledge of mqtt (for an alarm keypad and a Aqara button), I thought I’d make the move to mqtt for my opengarage unit earlier today. I used the code above but my Vehicle State entity was always shown as “Unavailable”. However, after some digging I found someone recently solved the problem for another user and so I’m posting it here for anyone else who struggles:
EDIT: Well that was strange - a reboot and I lost the vehicle distance reading. It took commenting out the json value line to bring it back. Thoroughly confused!
Just trying out @gabe565’s 1.1.2 OpenGarage firmware (thanks Gabe!)
For my implementation, I used the advice from @addie above, but created a package to keep everything pertaining to OpenGarage in a single file.
I also made use of the additional data being sent in the JSON MQTT payload on the OpenGarage/OUT/JSON message being sent by this new firmware to get the distance value.
For those not using this firmware yet, this new message contains content like:
{"dist":161,"door":0,"vehicle":1,"rcnt":98}
I added a packages folder to my file system, and in my configuration.yaml, did this:
Would you be able to provide more insight on how you implement this into Home Assistant? I have Home Assistant up and running, and I have my OpenGarage up and running, but I cannot seem to make a card with any OpenGarage information.
Is your OpenGarage talking to your Home Assistant over MQTT?
I used MQTT Explorer (on Windows) to subscribe to the MQTT topic “OpenGarage/#” and see what messages were flowing. It’s a great tool for purpose. I suppose you can also use the MQTT tooling in Home Assistant to subscribe to a topic, and perhaps that’s a better tool to make sure that HA is getting those messages (and vice-versa).
If you are using the package file I shared above, you should be able to add an Entities card to a lovelace dashboard with something like this inside:
I attempted to, but upon a configuration check I received this error:
Component error: packages - Integration ‘packages’ not found.
This is what my configuration.yaml looks like:
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
packages: !include_dir_named packages
From there I created a folder called packages, within packages I created a file called package_opengarage.yaml, and in that I copy / pasted what you included above.
I’m also confused where in your package you’re pointing to the OpenGarage unit IP, or how you’re having the OpenGarage unit get information into MQTT. I must be missing something :-\
So have it working to some extent; however I cannot seem to get the distance portion to show data. MQTT Explorer shows that information is being received by my MQTT server (see attached screenshot). I changed this portion:
so that JSON was DIST and a value of 0 at least started to appear (whereas previously it was Unknown, but that’s also clearly not correct since MQTT Explorer is able to show me that values are being discovered / recorded (around 298 - 300). Is this an aspect I need to edit / alter as well?
I’m having trouble understanding how the mqtt cover device works, but the up, down, stop buttons on the cover entity are payload_open, close and stop? Is it possible to send a payload command as a tap_action?
For example, if I am displaying the status of the garage door as a glance card, is it possible to use a tap_action to send the “up” command?