borski / ha-lucidmotors

Lucid Motors integration for Home Assistant through HACS
MIT License
6 stars 0 forks source link

Failed to contact Lucid cloud services #17

Open marschind opened 4 months ago

marschind commented 4 months ago

I've run across a problem that manifests as my garage mysteriously opens sometimes while I am home. I finally tracked it down to an automation script I got from Borski that basically says if my car enters the home zone, open the garage. The problem is that sometimes when this integration tries to get the current status from Lucid, it gets an error. When that happens, every sensor attached to the car goes to status "Unavailable", including the location. The next time it polls, it gets the current status, and the location goes back to "Home", which causes the garage to open. I haven't figured out how to modify the automation to track if the previous location was "Unavailable" to avoid opening the garage in this case, but perhaps a better solution is for the integration to not mark everything as Unavailable until some number of consecutive polls have failed.

nshp commented 4 months ago

I've run into this as well. Seems like the API is having intermittent issues recently. I got the error as much as 50 times in a day. A workaround on the automation side is to specifically catch a change from "Away" to "Home" rather than anything to "Home." I'll look over my logs and think about this though.

marschind commented 4 months ago

specifically catch a change from "Away" to "Home" rather than anything to "Home." I haven't figured out how to do this. I'm relatively new to HA and its scripting language. Though I'm making progress, as I did manage to get HA to replace 7 remotes to our entertainment system with a dashboard whose buttons change depending on what is going on.

nshp commented 4 months ago

In your automation you'll have a trigger section. I'm not sure what kind of trigger Borski used, there are many ways to skin the cat, but you can use a "state change" like this:

trigger:
  - platform: state
    entity_id:
      - device_tracker.<your_car>
    from: "not_home"
    to: "home"
marschind commented 4 months ago

Thanks. That worked.