Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More Sensors vor e-up #235

Open
marten-lucas opened this issue Oct 17, 2024 · 4 comments
Open

More Sensors vor e-up #235

marten-lucas opened this issue Oct 17, 2024 · 4 comments

Comments

@marten-lucas
Copy link

Hi,

using the mqtt method I got more sensors out of the WiCan then the profile has.
I have:

  • Range
  • Charge State
  • Plug State
  • Remaining Charge Time
  • Outside Temp

How can I contribute to the profile or test it locally first?

@meatpiHQ
Copy link
Owner

@marten-lucas you can post the mqtt requests and response that you're sending here and I can try and help you add them to the profile

@marten-lucas
Copy link
Author

Here is the script for the requests (mqtt needed alls data in dec):

` alias: Seat OBD2 Request
sequence:

  • alias: Request Outside Temp
    data:
    qos: "0"
    retain: false
    topic: wican/1091a817d1b9/can/tx
    payload: |-
    {
    "bus": "0",
    "type": "tx",
    "frame": [{
    "id": 1812,
    "dlc": 8,
    "rtr": false,
    "extd": false,
    "data":
    [3, 34, 16, 20, 170, 170, 170, 170]
    }]
    }
    action: mqtt.publish
  • delay:
    hours: 0
    minutes: 0
    seconds: 0
    milliseconds: 500
  • alias: Request SoC
    data:
    qos: "0"
    retain: false
    topic: wican/1091a817d1b9/can/tx
    payload: |-
    {
    "bus": "0",
    "type": "tx",
    "frame": [{
    "id": 1893,
    "dlc": 8,
    "rtr": false,
    "extd": false,
    "data":
    [3, 34, 29, 208, 170, 170, 170, 170]
    }]
    }
    action: mqtt.publish
  • delay:
    hours: 0
    minutes: 0
    seconds: 0
    milliseconds: 500
  • alias: Request Range
    data:
    qos: "0"
    retain: false
    topic: wican/1091a817d1b9/can/tx
    payload: |-
    {
    "bus": "0",
    "type": "tx",
    "frame": [{
    "id": 1812,
    "dlc": 8,
    "rtr": false,
    "extd": false,
    "data":
    [3, 34, 34, 224, 170, 170, 170, 170]
    }]
    }
    action: mqtt.publish
  • delay:
    hours: 0
    minutes: 0
    seconds: 0
    milliseconds: 500
  • alias: Request Plug State
    data:
    qos: "0"
    retain: false
    topic: wican/1091a817d1b9/can/tx
    payload: |-
    {
    "bus": "0",
    "type": "tx",
    "frame": [{
    "id": 2016,
    "dlc": 8,
    "rtr": false,
    "extd": true,
    "data": [3, 34, 22, 70, 170, 170, 170, 170]
    }]
    }
    action: mqtt.publish
  • delay:
    hours: 0
    minutes: 0
    seconds: 0
    milliseconds: 500
  • alias: Request Remaining Charge Time
    data:
    qos: "0"
    retain: false
    topic: wican/1091a817d1b9/can/tx
    payload: |-
    {
    "bus": "0",
    "type": "tx",
    "frame": [{
    "id": 1893,
    "dlc": 8,
    "rtr": false,
    "extd": true,
    "data": [3, 34, 29, 228, 170, 170, 170, 170]
    }]
    }
    action: mqtt.publish
  • delay:
    hours: 0
    minutes: 0
    seconds: 0
    milliseconds: 500
  • alias: Request Charge State
    data:
    qos: "0"
    retain: false
    topic: wican/1091a817d1b9/can/tx
    payload: |-
    {
    "bus": "0",
    "type": "tx",
    "frame": [{
    "id": 2021,
    "dlc": 8,
    "rtr": false,
    "extd": true,
    "data": [3, 34, 116, 72, 170, 170, 170, 170]
    }]
    }
    action: mqtt.publish
    mode: singleand here are the automations to catch the result: for Temperature:alias: Read Seat Temp per WiCan Mqtt (evcc)
    triggers:
  • topic: wican/1091a817d1b9/can/rx
    trigger: mqtt
    conditions:
  • condition: template
    value_template: "{{ trigger.payload_json.frame[0].id == 1918 }}"
  • condition: template
    value_template: "{{ trigger.payload_json.frame[0].data[2] == 16 }}"
  • condition: template
    value_template: "{{ trigger.payload_json.frame[0].data[3] == 20 }}"
    actions:
  • variables:
    v1: "{{ trigger.payload_json.frame[0].data[4] }}"
    outside_temp: "{{ (v1 / 2 - 50) | round(1) }}"
  • data:
    new_value: "{{ outside_temp }}"
    action: esphome.wallbox_controller_set_seat_temp
    mode: single `

For SoC:
'alias: Read Seat SoC per WiCan Mqtt (evcc)
description: ""
triggers:

  • topic: wican/1091a817d1b9/can/rx
    trigger: mqtt
    conditions:
  • condition: template
    value_template: "{{ trigger.payload_json.frame[0].id == 1999 }}"
  • condition: template
    value_template: "{{ trigger.payload_json.frame[0].data[2] == 29 }}"
  • condition: template
    value_template: "{{ trigger.payload_json.frame[0].data[3] == 208 }}"
    actions:
  • variables:
    state_of_charge: "{{ trigger.payload_json.frame[0].data[4] / 2 }}"
  • data:
    new_value: "{{ state_of_charge }}"
    action: esphome.wallbox_controller_set_seat_soc
    '
    for remaining time:
    'alias: Read Seat Remaining Time via MQTT (evcc)
    description: ""
    triggers:
  • topic: wican/1091a817d1b9/can/rx
    trigger: mqtt
    conditions:
  • condition: template
    value_template: "{{ trigger.payload_json.frame[0].id == 1999 }}"
  • condition: template
    value_template: "{{ trigger.payload_json.frame[0].data[2] == 29 }}"
    enabled: true
  • condition: template
    value_template: "{{ trigger.payload_json.frame[0].data[3] == 228 }}"
    enabled: true
    actions:
  • variables:
    charge_time_remaining: "{{ trigger.payload_json.frame[0].data[4] }}"
  • choose:
    • conditions:
      • condition: template
        value_template: "{{ charge_time_remaining > 125 }}"
        sequence:
      • action: esphome.wallbox_controller_set_seat_remainingtime
        data:
        new_value: 99999
        alias: car not charging
    • conditions:
      • condition: template
        value_template: "{{ charge_time_remaining <= 125 }}"
        sequence:
      • data:
        new_value: "{{ charge_time_remaining * 5 | int }}"
        action: esphome.wallbox_controller_set_seat_remainingtime
        alias: car charging, set remaining time
        mode: single
        '

For Range:
`alias: Read Seat Range per WiCan Mqtt (evcc)
description: ""
triggers:

  • topic: wican/1091a817d1b9/can/rx
    trigger: mqtt
    conditions:
  • condition: template
    value_template: "{{ trigger.payload_json.frame[0].id == 1918 }}"
  • condition: template
    value_template: "{{ trigger.payload_json.frame[0].data[2] == 34 }}"
  • condition: template
    value_template: "{{ trigger.payload_json.frame[0].data[3] == 224 }}"
    actions:
  • variables:
    v1: "{{ trigger.payload_json.frame[0].data[4] }}"
    v2: "{{ trigger.payload_json.frame[0].data[5] }}"
    v1_shifted: "{{ v1 | int * 256 }}"
    displayed_range: "{{ v1_shifted | int + v2 | int }}"
  • data:
    new_value: "{{ displayed_range }}"
    action: esphome.wallbox_controller_set_seat_range
    enabled: true
    for charge state:alias: Read Charge state Seat per MQTT (evcc)
    description: ""
    triggers:
  • topic: wican/1091a817d1b9/can/rx
    trigger: mqtt
    conditions:
  • condition: template
    value_template: "{{ trigger.payload_json.frame[0].id == 2029 }}"
  • condition: template
    value_template: "{{ trigger.payload_json.frame[0].data[2] == 116 }}"
  • condition: template
    value_template: "{{ trigger.payload_json.frame[0].data[3] == 72 }}"
    actions:
  • variables:
    charge_state: "{{ trigger.payload_json.frame[0].data[4] == 4 }}"
  • data:
    new_value: "{{ charge_state }}"
    action: esphome.wallbox_controller_set_seat_chargestate
    mode: single
    `

Plug state (not validated):
`
alias: Read Seat Plug State per MQTT (evcc)
description: ""
triggers:

  • topic: wican/1091a817d1b9/can/rx
    trigger: mqtt
    conditions:

  • condition: template
    value_template: "{{ trigger.payload_json.frame[0].id == 2024 }}"

  • condition: template
    value_template: "{{ trigger.payload_json.frame[0].data[2] == 22 }}"

  • condition: template
    value_template: "{{ trigger.payload_json.frame[0].data[3] == 70 }}"
    actions:

  • variables:
    plug_state: "{{ trigger.payload_json.frame[0].data[4] == 1 }}"

  • data:
    new_value: "{{ plug_state }}"
    action: esphome.wallbox_controller_set_seat_plugstate
    mode: single
    the plug state did not work as expected: here is the definition from http://obd-amigos.linuxtech.net/files/amigos_PIDs.pm : plg_ins=>{cmd=>'22 16 46', cu=>'01', desc=>'charging plug inserted', unit=>'', d=>1, formula=>'sprintf("%s", V1==0?"NO":V1==1?"YES":"V1")'}, # verified correct

    '01'=>{hdr=>'7E0', rhdr=>'7E8', fc=>0, desc=>'Engine'}, # +0x08 <
    `

@marten-lucas
Copy link
Author

I could try to prepare the json. but I would need an example with pid_init. b/c i would need to change the can_id.

@cr0i
Copy link
Contributor

cr0i commented Nov 15, 2024

pid_init is now working on VW: ID.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants