SAIC-iSmart-API / saic-python-mqtt-gateway

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Persist Gateway interval configuration after restart

jfreves opened this issue · comments

I usually change the Gateway inactive refresh period to a different value than the default but whenever the addon is restarted the value changes back to the default value.
Can this Gateway configuration be persisted instead?

Technically it should already be handled vie the configure_by_message() function. If it is not working maybe it has to do with the MQTT client state not being cleared. Are you publishing those messges with the retain flag set?

I have an input in my dashboard and use it to update the value, I'm not publishing messages directly.
image

Technically it should already be handled vie the configure_by_message() function. If it is not working maybe it has to do with the MQTT client state not being cleared. Are you publishing those messges with the retain flag set?

I've tried (unsuccessfully) to retain the refresh period.
YAML config of the entity:

    - name: mg4_refresh_active
      state_topic: "saic/xxx@gmail.com/vehicles/xxx/refresh/period/active"
      command_topic: "saic/xxx@gmail.com/vehicles/xxx/refresh/period/active/set"
      retain: true
      options:
        - "30"
        - "900"
        - "3600"

If I pick "900" as the value in HA I can see it's retained when I shut down the SAIC MQTT Gateway (Python) add-on.
As soon as I start the add-on I see the MQTT value revert to 30, and in the SAIC logs I see:
2024-01-30 22:22:13,590 [ INFO ] Setting active query interval in vehicle handler for VIN xxx to 0:00:30 - vehicle

@pmannk Found a potential root cause. Tentative fix scheduled for 0.6.2-rc12.

Please try it out and let me know

Thanks @nanomad ! I'm in Australia, so stuck on the legacy gateway unfortunately.
I'll see if I can merge just those changes from vehicle.py into my local install

Ah that's a shame, if you manage to retrofit it feel free to open a PR. We can create an ad-hoc maintenance branch for it