Mazda connected service

Not yet. I was planning to wait until after the climate PR is merged since that would make it a bit easier.

Worked on the first attempt :slight_smile: on my MX-30.

So now i have a TrƄdfri button i can hit to defrost and warm up the car shortly before i leave (with confirmation on a speaker)

1 Like

Tested now and worked, thanks! Great work @bdr9!
Is it possible to get the status of the car updated more frequently?
Example my car have been charing for 6-7 hours, but in HA it is not updated with new status on battery % or range. A update-button or make it check like every 30-60 min?

1 Like

@mumfix Refresh button already exists (3rd entry down). I donā€™t think by default it should check more often than it does now as it will be waking the car up to get updated stats which would impact the battery (certainly on something like the CX-60 with a 17kwh battery) especially during the cold season. You could rig up an automation to fire an update every hour if you wished

Omg Im blind. Thank @Townsmcp

1 Like

@fvant Nice idea with the TrƄdfri button! That sounds really useful.

@fvant, @mumfix, or @Townsmcp: Out of curiosity, how often do the entities update if you donā€™t press the refresh button? Also, do they update more often when the car is charging?

On my gas car, I donā€™t have the refresh button, and the entities never update unless I drive the car, but Iā€™m curious how it differs for the electric models.

I will be honest, I havenā€™t checked how often we get an update through. What I have noticed though is whenever the car sends an update to Mazda app, we then get updated stats in HA. So it appears to be a push service but certainly not regular when the car has gone into sleep mode (60 minutes after driving) - we can go for hours without an update and the next update is due to an activity taking place (charging starting/stopping, preheat etc) or, as you say, a drive taking place. In the Mazda app we can request a refresh of car info, again that would then update HA.

On a side note, the custom integration for hvac is working amazingly well. I have setup a NodeRed flow which I will share soon in case anyone wants to utilise it. The car allows us to set a preheat schedule however I donā€™t always want that and donā€™t want to be jumping in the car at night just to set a schedule. My automation works on input booleans to disable preheat. If I want the preheat enabled, then I want the PodPoint to start allowing charging (Iā€™m on a cheap overnight tariff so only want charging during certain hours with the exception being to charge while preheating the car).
With HA 12, there is a local calendar integration which I have been trying to utilise to set a regular schedule that the input booleans then override however it is not working for me at the moment. Next update should resolve that (bug fix didnā€™t make the cut for 12.0). The scheduled helper just isnā€™t granular enough from a time perspective to suite my needs (you can only set half hour times whereas I want to only preheat for 15 minutes)

1 Like

My car had been charging for around 6-7 hours and was not updated in that time. I refreshed in the mazda app, and after a while it updated in HA.

Cool, thanks for the info. By the way, in case you guys arenā€™t aware, the refresh button in HA does the same thing as refreshing the data in the Mazda app.

@Townsmcp, that node-red flow sounds great. There actually is a way to create a schedule entity with times more granular than 30 minutes. If you set up a schedule entity and then use a text editor to modify the file config/.storage/schedule/, you can manually edit the times there to whatever you want. Just make sure to restart HA after changing it. .storage is a hidden folder so you might need to change a setting to be able to view it.

Alternatively, you could configure the schedule in your configuration.yaml, as described here, but then you lose the ability to manage it in the web UI.

1 Like

Thx Brandon for the amazing work. Does this work for the CX-9 as well? I canā€™t find the entity in HA.

Unfortunately not. The climate entity is only available for electric vehicles like the MX-30 and CX-60.

@bdr9 i am noticing a bug with the defroster settings. If I change the setting to front and rear defroster, after a few seconds this goes back to the previous setting. If I set to rear defroster only, this also goes back to the previous setting (a couple of times I have had to push refresh to get an update but at that point it goes to previous setting). If I set to front defroster this option stays. Same for defroster off. Ultimately it appears if rear is selection as an option it wonā€™t stick

Can you check your home assistant logs to see if any errors appear from the Mazda integration when this problem happens?

I have enabled debugging (on integration page, click the dots at top right and enable debugging) however that has not revealed anything in the logs. Is the following line correct in yaml logger?

logs:
    homeassistant.components.mazda_connected_services: debug

I have noticed the following in logs though (which I know isnā€™t connected to this issue but just thought I would add it here for you)


Logger: homeassistant.helpers.frame
Source: helpers/frame.py:77 
First occurred: 9:15:03 am (1 occurrences) 
Last logged: 9:15:03 am

Detected integration that accesses the `name` property of the unit system. This is deprecated and will stop working in Home Assistant 2023.1. Please adjust to use instance check instead.. Please report issue to the custom integration author for mazda using this method at custom_components/mazda/sensor.py, line 55: if unit_system.name == CONF_UNIT_SYSTEM_IMPERIAL:

@Townsmcp Sorry for the delayed reply. Hereā€™s what you would need to add to your configuration.yaml to enable debug logging. The first line is for the Mazda integration itself, and the second is for pymazda, the library that the Mazda integration uses to communicate with Mazdaā€™s API.

logs:
    homeassistant.components.mazda: debug
    pymazda: debug

Thanks for the heads up about the deprecation warning. This is already fixed in HA core, just not in the custom integration.

1 Like

@bdr9 i did add the lines to my instance but nothing shows up in the logs when trying to enable rear defogger. Iā€™m wondering if the issue is with Mazda services itself - I have tried setting rear in Mazda app and am experiencing the same issue

Unfortunately I donā€™t think there is anything I can do about that. The HA integration is limited by what the Mazda app is able to do. So if the Mazda app is not able to do something, the HA integration wonā€™t be able to do it either.

I thought that would be the case. Next stop, Mazda! Lol

When I enable both front and rear screens using HA or the Mazda app, it always shows the rear screen as not being on.

Iā€™m pretty sure it is actually working though.

CX60

@StephenMilner ah ok. I see the same in the app (showing not on). At the point I then turn off both front and rear screens, send that update to the car, and then turn on again and send the command to the car. I havenā€™t actually just left it to see what happens. Definitely a bug in the Mazda app though. Plus the app hasnā€™t been updated in 7 months which is pretty poor form of Mazda - adding a new car to the app would have definitely revealed bugs in the interim