In the documentation it goes through each option for set up config and topic:
| /refresh/period/afterShutdown/set | refresh interval (sec) | After the vehicle has been shutdown, the gateway queries the status every 120 seconds (default value). The refresh interval can be modified with this topic. |
| /refresh/period/inActiveGrace/set | grace period (sec) | After the vehicle has been shutdown, the gateway continues to query the state for 600 seconds (default value). The duration of this extended query period can be modified with this topic. |
IOW it will (using default settings) poll the car a couple more times after it has been shut down but then cease polling after that.
Thanks wattmatters.
I’d figured that out about 2 hours ago!
The integration keeps polling the car after shutdown for 10 minutes at 2 minute intervals.
It’s pretty obvious really - a bit of a dumb question from me, but thanks for replying
FYI if you set those values they will be reset to their defaults the next time the add-on restarts.
There’s a fix for this in the newer release, however it wasn’t backported to the AU/NZ version. I briefly messed about with my local install to try and backport the fix however I wasn’t successful and haven’t had the time to dedicate to it furher.
Apologies, I missed your post.
Sure - the first few sensors are the normal ones provided by the integration (I have them defined manually as MQTT discovery is turned off in my deployment):
sensor.evse_kwh is specific to my EVSE (well actually the supply side) and has nothing to do with the car.
The rest are template sensors to capture “point in time” measurements. They’re updated whenever a charger is connected/disconnected:
template:
- trigger: #This trigger template sensor updates when the MG4 charger is unplugged, to capture the end of charging SOC
- platform: state
entity_id:
- sensor.mg4_charge_connected
from: "False"
to: "True"
sensor:
- name: "mg4_t_charge_start_soc_kwh"
icon: mdi:lightning-bolt-outline
unit_of_measurement: "kWh"
state: "{{ states('sensor.mg4_soc_kwh') }}"
- name: "mg4_t_charge_start_range_used"
icon: mdi:arrow-left-right
unit_of_measurement: "km"
state: "{{ states('sensor.mg4_u_distance_last_charge') }}"
- name: "mg4_t_charge_start_range_remaining"
icon: mdi:arrow-left-right
unit_of_measurement: "km"
state: "{{ states('sensor.mg4_range') }}"
- trigger: #This trigger template sensor updates when the MG4 charger is unplugged, to capture the end of charging SOC
- platform: state
entity_id:
- sensor.mg4_charge_connected
from: "True"
to: "False"
sensor:
- name: "mg4_t_charge_end_soc_kwh"
icon: mdi:lightning-bolt-outline
unit_of_measurement: "kWh"
state: "{{ states('sensor.mg4_soc_kwh') }}"
And I have a utility meter sensor that’s referenced by one of the template sensors. There’s an automation which resets its value when the charger is unplugged
utility_meter:
mg4_u_distance_last_charge: #Note, this counter is reset by an automation when charger is disconnected
source: sensor.mg4_distance_total
The mg flow from grid is from a current sensor I had in my power meter box. I have the MG charger but wasn’t able to integrate it. This was my work around solution.
Ah I have a MyEnergi Zappi which does expose some via its CT Clamp but this is data for the whole house.
I suppose I could make a Derivative sensor if it exceeds a certain % for a period of time. As typical use seems to be low and turning on EV charger nets it shooting to over 7kwH
Actually edit; found sensor.myenergi_home_power_charging which shows the W use of charging in real time.
everything else can be copied straight from the legacy version.
Fun fact though, If you keep HA using the legacy version then you can use the 2.0 app and have both going together.
As soon as you setup the newer HA addin it logs you out of the app again.
Has this been reliable for you?
I get a lot of {"code":6,"message":"The service is not available,please try again later."} errors using the new API endpoint.
Have reverted to the legacy one for the time being.
The add-in works, but it throws that error on a semi regular basis.
Good suggestion on logging in with the mobile app - I tried that, and obviously it works too, however the SAIC HA addin is still returning that same error intermittently.
I updated mine today to latest (no tag) using the uri and region suggested by @lkernan , and its been running fine. I cant see that error anywhere in my logs.
Is it possible the phone app keeps connecting and they are kicking each other out?
It was doing it before I installed the mobile app (I only installed the mobile app in the hope it fixed the issue).
Interestingly over the past couple of days I haven’t had any more errors. Still not sure what the underlying issue was as I’ve changed nothing in my config and haven’t restarted HA, the add-in or any of my networking gear.
Will keep an eye on it but for the moment it seems stable.