The mazda integration is already very useful. One thing that might add to the utility is a status of whether or not the windows are left open after parking the car.
One possible use case is parking outside without a garage, this could help alert the user if they forgot to close the windows.
Hi @LMR, I think this is a great idea. I have a few other changes to the Mazda integration that I need to work on first, but I’ll probably implement window status soon.
Btw, I use this integration instead of the official Mazda app. It’s so much more helpful for most of the use cases I can think of. Plus, the extensibility of HA just makes it more helpful in general for things like notifications and status vs. just getting spammed by the Mazda app.
I did some testing today regarding the car window status feature. The Mazda API does include info about whether the car windows are open or closed, but unfortunately it doesn’t seem to be working for me. Even if I open the car window, it still shows as if it is closed.
Would you be able to do a bit of testing for me? If you are able to run Python code, can you test pymazda with your car to see if the window status is reflected properly in the get_vehicle_status() response? It would be helpful to have confirmation that this is not just an issue with my car specifically. Also, when your car window is left open, do you see this information anywhere in the MyMazda app?
Thanks for following up! I’ll be happy to do some testing. I should mention that I am a beginner with python. I see the quickstart example in your github readme page but I’m so out of practice, I don’t even know where to use this.
I opened the app and tried to get some response based on the window states in the app UI. I wasn’t able to see anything specific to windows. I know it’s working and the car is reporting states though. For instance I was able to open the hood and see that the car reported an open status for the hood. Same with doors locked / unlocked. Not sure if the app is able to report windows though. Seems like the next step would be what you are asking, and once I can figure out how I’d be happy to check the get_vehicle_status() response.
What’s the quickest / easiest way for someone with minimal experience to get up and running with this type of testing? Also, are you using IDLE or some other way to run the Python code?
Thanks for being so willing to help! I actually thought of an easier way that doesn’t require any Python setup. I have created a version of the Mazda integration that includes support for doors, hood, trunk, and window status. It is packaged as a custom component and you can download it here. If you place the “mazda” folder from the zip file inside your “custom_components” folder and then restart HA, then you will be using the custom component. It would be great if you could check whether the door, hood, trunk, and window binary sensors are working with your car. I don’t think the window one will work since it doesn’t work in the official app either, but the others should.
Keep in mind the integration only refreshes the latest data from the Mazda API every 3 minutes, so there may be a bit of delay.
I was able to install the custom component and test a few of the functions:
Values
Hood open: functions as intended
Trunk open: functions as intended
Door locked/unlocked: inconclusive (but I have no reason to believe it doesn’t work)
Door opened/closed: inconclusive (but I have no reason to believe it doesn’t work)
Windows open/closed: inconclusive (this may be a limitation of the Mazda API?)
Tire pressures: functions as intended
Odometer: functions as intended
Commands
Lock/unlock doors: functions as intended
While I didn’t test everything conclusively, this is already an improvement over the released version of the integration.
Previously, I had tested the start engine command on the released integration and it worked well, so I didn’t test that.
Until I’ve been able to see any feedback regarding the window states, I’ll assume that the window states are not functionally available and that it is likely due to a limitation on the Mazda API side of things.
By the way, is there any way for me to view the logs or somehow see what data is being sent back from the Mazda API to HA?
Thanks for all of the testing! It’s great to have confirmation that these features are working for you. I agree with your conclusion that the window status is not working correctly on the Mazda API side, and there is likely nothing we can do about that. The door status is working fine for me so I am confident it would work for you as well.
If you’re interested in seeing the raw response data from the Mazda API, I actually added functionality to log this info to the HA debug logs. To use it, first download and install this custom component. Then, add the following to your configuration.yaml and restart HA. In the logs, you will see each request that is made to the Mazda API, and the response data for the request.
logger:
default: warn
logs:
pymazda: debug
By the way, when you’re finished experimenting with the custom component, don’t forget to delete it from your custom_components folder. Otherwise, it will override the released version and you will not get any future improvements to the Mazda integration with newer releases of HA.
@bdr9 thanks, this is helpful. I was able to install the new custom component with the logging enabled. I snagged the first response and put it into a JSON viewer. It’s interesting that there’s a sunroof value. Looks like there’s actually two sunroof values: SrSlideSignal and SrTiltSignal.
It’s certainly interesting viewing the raw response data from the Mazda API. There are so many attributes that don’t work and/or don’t seem to be used by the mobile app. Maybe Mazda originally planned for the app to have more features.
The sunroof values are interesting, I hadn’t noticed those before. I did see the window values, and those are what I attempted to use, but unfortunately they seem to always be 0 regardless of the actual state of the windows.
By the way, I submitted a pull request to HA core. It includes all of the binary sensor entities from the custom integration you tested, except for the windows. If it gets approved and merged within the next few days, then the binary sensor entities will be included in HA 2022.2.