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

A service that queries the data from an MG iSMART account and publishes the data over MQTT and to other sources
MIT License
71 stars 23 forks source link

Can't enable climate in domoticz #174

Closed billouetaudrey closed 8 months ago

billouetaudrey commented 8 months ago

Hello, on domoticz, I can set temperature but can't activate clim ( Marvel R )

"Error sending switch command, check device/hardware (idx=95) !"

Logs :

2024-02-25 11:41:18.593 Error: MQTT Disovery: climate device unhandled mode_state_template (***_vehicle_climate/MG Marvel R (Climatisation))

nanomad commented 8 months ago

Is the log from domoticz? Or the python gateway?

I'm not a domoticz user so I cannot help too much

billouetaudrey commented 8 months ago

Sorry for delay, it's Domoticz log

python said when I change temp :

2024-03-11 17:05:07,600 [ INFO ] Setting remote climate target temperature to {"{{ value | int }}":23.0} - __main__ 2024-03-11 17:05:07,600 [ ERROR ] Error setting temperature target: invalid literal for int() with base 10: '{"{{ value | int }}":23.0}' - __main__ Traceback (most recent call last): File "/usr/src/app/./mqtt_gateway.py", line 180, in handle_mqtt_command temp = int(payload) ^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: '{"{{ value | int }}":23.0}' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/app/./mqtt_gateway.py", line 189, in handle_mqtt_command raise MqttGatewayException(f'Error setting temperature target: {e}') exceptions.MqttGatewayException: Error setting temperature target: invalid literal for int() with base 10: '{"{{ value | int }}":23.0}'

nanomad commented 8 months ago

Seems like domoticz doesn't support value templates in YAML format, but still honors the home-assistant auto configuration messages.

I'd suggest rasing a ticket to domoticz

Here's the auto-configuration message sent to the relevant topic

{
  "name": "Vehicle climate",
  "device": {
    "name": "MG MG4 Electric <VIN>",
    "manufacturer": "MG",
    "model": "MG4 Electric 2022 BLACK PEARL",
    "hw_version": "EH32 S",
    "identifiers": [
      "<VIN>"
    ]
  },
  "unique_id": "<VIN>_vehicle_climate",
  "object_id": "<VIN>_vehicle_climate",
  "availability": [
    {
      "topic": "saic/_internal/lwt",
      "payload_available": "online",
      "payload_not_available": "offline"
    },
    {
      "topic": "saic/<EMAIL>/vehicles/<VIN>/available",
      "payload_available": "online",
      "payload_not_available": "offline"
    }
  ],
  "availability_mode": "all",
  "precision": 1.0,
  "temperature_unit": "C",
  "mode_state_topic": "saic/<EMAIL>/vehicles/<VIN>/climate/remoteClimateState",
  "mode_command_topic": "saic/<EMAIL>/vehicles/<VIN>/climate/remoteClimateState/set",
  "mode_state_template": "{% if value == \"on\" %}auto{% else %}off{% endif %}",
  "mode_command_template": "{% if value == \"auto\" %}on{% else %}off{% endif %}",
  "modes": [
    "off",
    "auto"
  ],
  "current_temperature_topic": "saic/<EMAIL>/vehicles/<VIN>/climate/interiorTemperature",
  "current_temperature_template": "{{ value }}",
  "temperature_command_topic": "saic/<EMAIL>/vehicles/<VIN>/climate/remoteTemperature/set",
  "temperature_command_template": "{{ value | int }}",
  "temperature_state_topic": "saic/<EMAIL>/vehicles/<VIN>/climate/remoteTemperature",
  "temperature_state_template": "{{ value | int }}",
  "min_temp": 17,
  "max_temp": 33
}
billouetaudrey commented 8 months ago

Seems like domoticz doesn't support value templates in YAML format, but still honors the home-assistant auto configuration messages.

I'd suggest rasing a ticket to domoticz

Here's the auto-configuration message sent to the relevant topic

{
  "name": "Vehicle climate",
  "device": {
    "name": "MG MG4 Electric <VIN>",
    "manufacturer": "MG",
    "model": "MG4 Electric 2022 BLACK PEARL",
    "hw_version": "EH32 S",
    "identifiers": [
      "<VIN>"
    ]
  },
  "unique_id": "<VIN>_vehicle_climate",
  "object_id": "<VIN>_vehicle_climate",
  "availability": [
    {
      "topic": "saic/_internal/lwt",
      "payload_available": "online",
      "payload_not_available": "offline"
    },
    {
      "topic": "saic/<EMAIL>/vehicles/<VIN>/available",
      "payload_available": "online",
      "payload_not_available": "offline"
    }
  ],
  "availability_mode": "all",
  "precision": 1.0,
  "temperature_unit": "C",
  "mode_state_topic": "saic/<EMAIL>/vehicles/<VIN>/climate/remoteClimateState",
  "mode_command_topic": "saic/<EMAIL>/vehicles/<VIN>/climate/remoteClimateState/set",
  "mode_state_template": "{% if value == \"on\" %}auto{% else %}off{% endif %}",
  "mode_command_template": "{% if value == \"auto\" %}on{% else %}off{% endif %}",
  "modes": [
    "off",
    "auto"
  ],
  "current_temperature_topic": "saic/<EMAIL>/vehicles/<VIN>/climate/interiorTemperature",
  "current_temperature_template": "{{ value }}",
  "temperature_command_topic": "saic/<EMAIL>/vehicles/<VIN>/climate/remoteTemperature/set",
  "temperature_command_template": "{{ value | int }}",
  "temperature_state_topic": "saic/<EMAIL>/vehicles/<VIN>/climate/remoteTemperature",
  "temperature_state_template": "{{ value | int }}",
  "min_temp": 17,
  "max_temp": 33
}

Lemme try with home assistant ;) thanks

billouetaudrey commented 8 months ago

Confirmed, work with home assistant, sorry for disturb