Anyone else expiring issues with their implementation in HA atm ?
I got the iOS app update today of the MG smart and it didn’t work for an hour as said network error and later I had to log off and back to get it to work. But it does work now. But now I noticed that the add on in home assistant is crashed with errors in the log so my entities are unavailable. And if I start it again shortly after it crashed. Just wonder if I’m the only one seeing this.
Update: The watchdog to make sure the add-on runs in case of a failure does not kick in on this crash so it stays in stopped state due to this exception.
task crashed with an exception - __main__
Traceback (most recent call last):
File "/usr/src/app/./mqtt_gateway.py", line 90, in handle_vehicle
vehicle_status = self.update_vehicle_status()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/app/./mqtt_gateway.py", line 110, in update_vehicle_status
vehicle_status_rsp_msg = self.saic_api.get_vehicle_status_with_retry(self.vin_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/saic_ismart_client/saic_api.py", line 193, in get_vehicle_status_with_retry
return self.handle_retry(self.get_vehicle_status, vin_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/saic_ismart_client/saic_api.py", line 457, in handle_retry
return self.__handle_retry_with_app_data(func, vin_info=vin_info, max_retries=max_retries)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/saic_ismart_client/saic_api.py", line 488, in __handle_retry_with_app_data
rsp = func(vin_info)
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/saic_ismart_client/saic_api.py", line 188, in get_vehicle_status
self.message_V2_1_coder.decode_response(vehicle_status_rsp_hex, vehicle_status_rsp_msg)
File "/usr/local/lib/python3.11/site-packages/saic_ismart_client/ota_v2_1/Message.py", line 12, in decode_response
return super().decode_response(message, decoded_message)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/saic_ismart_client/common_model.py", line 495, in decode_response
buffered_message_bytes = io.BytesIO(bytes.fromhex(message[5:]))
^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: non-hexadecimal number found in fromhex() arg at position 4
Hi TripleJ,
Yes, I experience the same behaviour. I am running the saic-python-mqtt-gateway in a docker container and I’ve seen it restart a few times during the last couple of hours and values are not updated. My MG iOS app also doesn’t load any updated values which makes me think this has something to do with MG’s api not responding.
I think you are right that is MG’s Api having issues or perhaps even some changes to it that causes the integration crash like this. But also as we have seen their own app has issues. I also threw the error code here for the developer to see the exception and perhaps figure out how to properly handle it so it does not crash like so. But I should properly see if someone have shared this at GitHub, and if not post it there so they can get a proper ticket to look at the exception.
The addon has moved to using the “new” SAIC API.
If it doesn’t work you need to switch to using the legacy version of the integration from the add-on store.
For example, those of us in Australia apparently don’t have the new API yet. We need to use the legacy one for now.
edit: Nov 2024: Australia has now moved to iSmart 2.0 as well. The normal version of the addon now works.
The new latest version works great for me for my Marvel R.
After the crashes and now developer released the new version I just updated and things started to work again on this new API.
I don’t know what will happen when you switch to legacy, but since it is most likely the url and api calls the entities will stay the same I would assume.
Does anyone have a working MQTT climate configuration they would like to share?
I’ve gone around in circles trying to get this part working. When I attempt to turn the air on HA reports the HVAC_MODE “on” as not being valid.
I tried using power_command_topic instead of mode_command_topic without success too.
Here’s my configuration if someone has any tips. Thanks!
Yes they stay the same, since they both set them up by VIN.
I’ve got both installed at the moment with the new one stopped and there’s no problem with that.
Thanks. I deliberately wanted an MQTT climate entity rather than a switch entity so that the domain (climate) is correct. I couldn’t find any other way to change the domain type of an entity.
The other reason for not using the auto-created entities is so I can apply templates, limits and personalisations to the values.
Ironic you mention the 87°C game… it was one of the things I wanted to template out.
I ended up getting my MQTT climate: entry to work.
Not convinced it’s the best or most elegant way, but it achieved the exact result I was looking for.
Still need to refine the if/else statements to better handle unknown/other conditions, but at least the concept and commands are proven.
mqtt:
climate:
- name: mg4_climate_control
current_temperature_topic: "saic/[email protected]/vehicles/LSJxxx/climate/interiorTemperature"
current_temperature_template: "{{ '' if value == '87' else value }}"
mode_command_topic: "saic/[email protected]/vehicles/LSJxxx/climate/remoteClimateState/set"
mode_command_template: "{{ 'off' if value == 'off' else 'on' }}"
mode_state_topic: "saic/[email protected]/vehicles/LSJxxx/climate/remoteClimateState"
mode_state_template: "{{ 'off' if value == 'off' else 'auto' }}"
temperature_command_topic: "saic/[email protected]/vehicles/LSJxxx/climate/remoteTemperature/set"
temperature_command_template: "{{ value |int }}"
min_temp: 20
max_temp: 28
initial: 24
precision: 1.0
modes:
- "auto"
- "off"
87° no longer gets logged in the history or status, it just returns ‘unknown’.
The new python updated version 5.x works great for me. But I have now seen af few times that I get the message from the iOS app that the user is locked in another place. I didn’t have that with the legacy api.
I used the mail in Home assistant and the phone number in the app. Perhaps now with the new API it’s a problem to use it both places despite of the mail / phone distinction.
Hi, I have integrated the vehicle according to the instructions of user bkluivingh. Thank you very much. Everything was successful.
But I have a problem that I can’t set the cabin heating temperature or the fan intensity, and moreover it shows 87°C??? It is only Off or Auto. How can I please set the cabin heating temperature? Thank you
All of this is normal. The 87°C is an MG glitch: the iSmart app will also show that, unless they’ve filtered it out in the latest versions. “Auto” is effectively the same as “On”, but the car will handle switching itself off after 10 mins or when up to temperature.
I don’t think you can adjust the target temperature that has been set in the car, but a) I could be wrong and b) it doesn’t really matter as you’re only using it to pre-heat / defrost.
If you don’t have any other MQTT entities defined in configuration.yaml, it can go straight in there. You’ll need to replace the MY_EMAIL and MY_VIN, and you can give it a different unique_id if you want.