ipsBruno / haval-h6-gwm-alexa-chatgpt-mqtt-integration

A f** challenge
13 stars 3 forks source link

depurar comandos mqtt #3

Open ipsBruno opened 5 months ago

ipsBruno commented 5 months ago

ao pegar status do veiculo temos algo como

image

precisa fazer uma engenharia reversa nos dados para descobrir o que significa cada código, tive um achado importante dentro de uma decompilação java da haval onde supostamente mostravam todos estes códigos e seus respectivos significados... também encontrei um gist de um usuário @bossoq que já depurou todos códigos para o carro da gwm ora, e estes são os mesmos da Haval

code desc unit latest value
2103010 Total Mileage Km 9754
2013021 SoC % 41
2011007 Range km 212
2208001 Lock State (1: Unlock 0: Lock) - 0
2202001 AC State (1: On 0: Off) null 0
2078020 Cockpit air filtering (1: On 0: Off) null 0
2206002 FR Door State (1: Open 0: Close) - 0
2206004 FL Door State (1: Open 0: Close) - 0
2206003 RR Door State (1: Open 0: Close) - 0
2206005 RL Door State (1: Open 0: Close) - 0
2206001 Trunk State (1: Open 0: Close) - 0
2210001 FR Windows Position (1: Close 0: Open) - 1
2210002 FL Windows Position (1: Close 0: Open) - 1
2210003 RR Windows Position (1: Close 0: Open) - 1
2210004 RL Windows Position (1: Close 0: Open) - 1
2210005 Sunroof Position (6: Open 3: Close) - 1
2101002 FR Tire Pressure PSI 37.8
2101001 FL Tire Pressure PSI 37.8
2101004 RR Tire Pressure PSI 38.0
2101003 RL Tire Pressure PSI 37.6
2101006 FR Tire Temperature °C 40
2101005 FL Tire Temperature °C 42
2101008 RR Tire Temperature °C 40
2101007 RL Tire Temperature °C 39
2013022 Charge Time min 647
2013023 Schedule Charge (1: On 0: Off) null 0
2041142 Charge Status (0: Not Charge 1: Charge 2: Awaiting Charging 6: error) null 0
2042082 Charge Control Status (1: Plugin 0: Not Plugin) null 0
2204007 Head Light State (1: On 0: Off) - 0
2204010 Right Turn Signal (1: On 0: Off) - 0
2204009 Left Turn Signal (1: On 0: Off) - 0
2310001 GPS Authorization (1: Authorized 0: Unauthorized) null 1
2102002 FR Tire Pressure State - 0
2102001 FL Tire Pressure State - 0
2102004 RR Tire Pressure State - 0
2102003 RL Tire Pressure State - 0
2102008 FR Tire Temp State - 0
2102007 FL Tire Temp State - 0
2102010 RR Tire Temp State - 0
2102009 RL Tire Temp State - 0
2210010 FR Windows Learn State - 1
2210011 FL Windows Learn State - 1
2210012 RR Windows Learn State - 1
2210013 RL Windows Learn State - 1
2222001 Front Defrost State (Not Working) null 0
2210032 Rear Defrost State (Not Working) null 0
2202099 Air Cleaner State (Not Working) null 0
2212001 Hood State (Not Working) null 0
2201001 Room Temperature (Not Working) null 0
2013005 SoC (Redundant) null 41
2017002 Fuel Level (Not Working on GC) L 0
2016001 Unknown (Not Working) - 0
2011002 Unknown (Not Working) Km 0.0
ipsBruno commented 5 months ago

Aqui exemplo de resposta meu veículo

 {
  id: 'LGWFFUA59RH935162_0_STATUS',
  deviceId: 'LGWFFUA59RH935162',
  deviceType: 0,
  command: 'STATUS',
  items: [
    { code: '2013021', value: '76', unit: '%' },
    { code: '2013022', value: '1022', unit: 'minute' },
    { code: '2013023', value: '0', unit: null },
    { code: '2210001', value: '1', unit: '-' },
    { code: '2210002', value: '1', unit: '-' },
    { code: '2210005', value: '3', unit: '-' },
    { code: '2210003', value: '1', unit: '-' },
    { code: '2210004', value: '1', unit: '-' },
    { code: '2210012', value: '1', unit: null },
    { code: '2210013', value: '1', unit: null },
    { code: '2210010', value: '1', unit: null },
    { code: '2210011', value: '1', unit: null },
    { code: '4105008', value: 1, unit: null },
    { code: '2310001', value: 1, unit: null },
    { code: '2013005', value: '74', unit: '%' },
    { code: '2206005', value: '0', unit: '-' },
    { code: '2206004', value: '0', unit: '-' },
    { code: '2206003', value: '1', unit: '-' },
    { code: '2206002', value: '1', unit: '-' },
    { code: '2206001', value: '0', unit: '-' },
    { code: '2011007', value: '449', unit: 'km' },
    { code: '2102001', value: '0', unit: '-' },
    { code: '2102002', value: '0', unit: '-' },
    { code: '2102003', value: '0', unit: '-' },
    { code: '2102004', value: '0', unit: '-' },
    { code: '2102007', value: '0', unit: '-' },
    { code: '2102008', value: '0', unit: '-' },
    { code: '2102009', value: '0', unit: '-' },
    { code: '2102010', value: '0', unit: '-' },
    { code: '2042082', value: '0', unit: '-' },
    { code: '2220003', value: '0', unit: '-' },
    { code: '2220004', value: '0', unit: '-' },
    { code: '2103010', value: 1922, unit: 'Km' },
    { code: '2208001', value: '1', unit: '-' },
    { code: '2041142', value: '0', unit: '7' },
    { code: '2202099', value: '0', unit: '-' },
    { code: '2101001', value: 244, unit: 'kPa' },
    { code: '2101002', value: 235, unit: 'kPa' },
    { code: '2101003', value: 244, unit: 'kPa' },
    { code: '2101004', value: 244, unit: 'kPa' },
    { code: '2101005', value: '11', unit: '�C' },
    { code: '2101006', value: '10', unit: '�C' },
    { code: '2101007', value: '10', unit: '�C' },
    { code: '2101008', value: '9', unit: '�C' },
    { code: '2011501', value: '124', unit: 'Km' },
    { code: '2017002', value: '36', unit: 'L' },
    { code: '2202001', value: '0', unit: null }
  ],
  acquisitionTime: 1716872134364,
  uploadTime: null,
  updateTime: 1716872135411,
  longitude: -51.216198,
  latitude: -29.185383,
  globalStatusList: null,
  oilQty: 3,
  charge: null,
  percentageOfOil: null
}
ipsBruno commented 3 months ago

Pessoal, com alegria informo que consegui rodar comando para alterar a temperatura do ar condicionado da Haval, fiz alguns testes me baseando no codigo alemao

Segue aqui exemplo de como deixar a temperatura do carro em 20 graus

    let uniqueId = carApp.uuid()
    let arCond = await carApp.sendCmd(
        {
            "0x04": {
                "airConditioner": {
                    "operationTime": "5",
                    "switchOrder": "1",
                    "temperature": "20"
                }
            }
        },
        0,
        `PIN_DE_SEGURANCA_EM_MD5`,
        uniqueId,
        2,
        vin
    )
    console.log(arCond)

Deve retornar { code: '000000', description: 'SUCCESS' }

Estou muito contente porque agora isso abrira portas para executar comandos na Haval depurando a aplicacao da GWM, antes so estavamos conseguindo ler informacoes sobre o carro e nada mais.

A ideia minha aqui e integrar o ChatGPT com o veiculo e tornar o carro mais inteligente.

carvalr commented 5 days ago

Já integramos com o HA e podemos dar o comando do AC via relógio. Isso é muito útil em dias quentes e que vc quer fazer isso rápido. https://github.com/havaleiros/hassio-haval-h6-to-mqtt