homeassistant-jlrincontrol icon indicating copy to clipboard operation
homeassistant-jlrincontrol copied to clipboard

Improving Service Call documentation

Open stefferber opened this issue 3 years ago • 3 comments

@msp1974 and @ardevd did an excellent job supporting JLR connectivity.

Let's add some more details to the service call documentation. I am posting what I understood and maybe you can add and improve based on services.yaml, jlrpy.py, JLR integration discussion, and recipies

sensor.my_car_info and lock.my_car_doors has to be adapted below to the device name in your Jaguar Landrover InControl configuration; for me this is sensor.jaguar_info and lock.jaguar_doors. I will use simple button for the UI here - as I assume that is the simplest way to copy paste for testing.

1. Update Health Status (forces update from vehicle)

service: jlrincontrol.update_health_status
service_data:
    entity_id: sensor.my_car_info

example

entity: sensor.my_car_info
type: button
hold_action:
  action: more-info
name: Update My Car
show_icon: true
show_name: true
tap_action:
  action: call-service
  service: jlrincontrol.update_health_status
  service_data:
    entity_id: sensor.my_car_info

2. Honk/Flash

service: jlrincontrol.honk_blink
service_data:
  entity_id: sensor.my_car_info

example

  • [ ] tbd

3. Lock/Unlock

service: jlrincontrol.lock_vehicle
service_data:
  entity_id: sensor.my_car_info
  pin: XXXX
service: jlrincontrol.unlock_vehicle
service_data:
  entity_id: sensor.my_car_info
  pin: XXXX

example

type: button
entity: lock.my_car_doors
hold_action:
  action: more-info
icon: 'mdi:car-door-lock'
name: Lock Doors
show_icon: true
show_name: true
tap_action:
  action: call-service
  service: jlrincontrol.lock_vehicle
  service_data:
    entity_id: sensor.my_car_info
    pin: XXXX
type: button
entity: lock.my_car_doors
hold_action:
  action: more-info
name: Unlock Doors
show_icon: true
show_name: true
tap_action:
  action: call-service
  service: jlrincontrol.unlock_vehicle
  service_data:
    entity_id: sensor.my_car_info
    pin: XXXX
icon: 'mdi:car-door'

4. Start Engine/Stop Engine

service: jlrincontrol.start_vehicle
service_data:
  entity_id: sensor.my_car_info
  pin: XXXX
  target_value: <target temperature precondition value ?>
service: jlrincontrol.stop_vehicle
service_data:
  entity_id: sensor.my_car_info
  pin: XXXX

example

  • [ ] tbd

5. Start Charging/Stop Charging

service: jlrincontrol.start_charging
service_data:
  entity_id: sensor.my_car_info
service: jlrincontrol.stop_charging
service_data:
  entity_id: sensor.my_car_info

example

  • [ ] tbd

6. Reset Alarm

service: jlrincontrol.reset_alarm
service_data:
  entity_id: sensor.jaguar_info
  pin: XXXX
  • [ ] tbd

7. Start Preconditioning/Stop Preconditioning

service: jlrincontrol.start_preconditioning
service_data:
  entity_id: sensor.my_car_info
  target_temp: <temperature value>
service: jlrincontrol.stop_preconditioning
service_data:
  entity_id: sensor.my_car_info

example

type: button
show_icon: true
icon: 'mdi:fan'
name: Start preconditioning at 21°C
show_state: true
tap_action:
  action: call-service
  service: jlrincontrol.start_preconditioning
  service_data:
    entity_id: sensor.my_car_info
    target_temp: 21
hold_action:
  action: none
entity: sensor.my_car_info

8. Set Max Charge (Always and One Off)

service: jlrincontrol.set_one_off_max_charge_level
service_data:
  entity_id: sensor.my_car_info
service: jlrincontrol.set_max_charge_level
service_data:
  entity_id: sensor.my_car_info
 charge_level:  <in %>

example

  • [ ] tbd

stefferber avatar Apr 05 '21 12:04 stefferber

or everything in one card?

Bildschirmfoto 2021-04-05 um 20 14 47
cards:
  - cards:
      - entity: lock.my_car_doors
        hold_action:
          action: more-info
        icon: 'mdi:car-door-lock'
        name: Lock Doors
        show_icon: true
        show_name: true
        tap_action:
          action: call-service
          service: jlrincontrol.lock_vehicle
          service_data:
            entity_id: sensor.my_car_info
            pin: XXXX
          target: {}
        type: button
      - entity: lock.my_car_doors
        hold_action:
          action: more-info
        icon: 'mdi:car-door'
        name: Unlock Doors
        show_icon: true
        show_name: true
        tap_action:
          action: call-service
          service: jlrincontrol.unlock_vehicle
          service_data:
            entity_id: sensor.my_car_info
            pin: XXXX
          target: {}
        type: button
    type: horizontal-stack
  - cards:
      - entity: sensor.my_car_info
        hold_action:
          action: more-info
        name: Start Engine
        show_icon: true
        show_name: true
        tap_action:
          action: call-service
          service: jlrincontrol.start_vehicle
          service_data:
            entity_id: sensor.my_car_info
            pin: XXXX
            target_value: 21
          target: {}
        type: button
        icon: 'mdi:car-cog'
      - entity: sensor.my_car_info
        hold_action:
          action: more-info
        icon: 'mdi:car-off'
        name: Stop Engine
        show_icon: true
        show_name: true
        tap_action:
          action: call-service
          service: jlrincontrol.stop_vehicle
          service_data:
            entity_id: sensor.my_car_info
            pin: XXXX
          target: {}
        type: button
    type: horizontal-stack
  - type: horizontal-stack
    cards:
      - type: button
        show_icon: true
        icon: 'mdi:fan'
        name: Start preconditioning 21°C
        show_state: false
        tap_action:
          action: call-service
          service: jlrincontrol.start_preconditioning
          service_data:
            entity_id: sensor.my_car_info
            target_temp: 21
        hold_action:
          action: none
        entity: sensor.my_car_info
        show_name: true
      - type: button
        show_icon: true
        icon: 'mdi:fan-off'
        name: Stop preconditioning
        show_state: false
        tap_action:
          action: call-service
          service: jlrincontrol.stop_preconditioning
          service_data:
            entity_id: sensor.my_car_info
        hold_action:
          action: none
        entity: sensor.my_car_info
  - cards:
      - entity: sensor.my_car_info
        hold_action:
          action: more-info
        name: Start Charging
        show_icon: true
        show_name: true
        tap_action:
          action: call-service
          service: jlrincontrol.start_charging
          service_data:
            entity_id: sensor.my_car_info
        type: button
        icon: 'mdi:car-electric'
      - entity: sensor.my_car_info
        hold_action:
          action: more-info
        icon: 'mdi:car-electric-outline'
        name: Stop Charging
        show_icon: true
        show_name: true
        tap_action:
          action: call-service
          service: jlrincontrol.stop_charging
          service_data:
            entity_id: sensor.my_car_info
        type: button
    type: horizontal-stack
  - type: horizontal-stack
    cards:
      - type: button
        entity: sensor.my_car_info
        hold_action:
          action: more-info
        name: Update My Car
        show_icon: true
        show_name: true
        tap_action:
          action: call-service
          service: jlrincontrol.update_health_status
          service_data:
            entity_id: sensor.my_car_info
        icon: 'mdi:reload'
        show_state: false
      - type: button
        entity: sensor.my_car_info
        hold_action:
          action: more-info
        name: Honk & Blink
        show_icon: true
        icon: 'mdi:bugle'
        show_name: true
        tap_action:
          action: call-service
          service: jlrincontrol.honk_blink
          service_data:
            entity_id: sensor.my_car_info
type: vertical-stack

stefferber avatar Apr 05 '21 18:04 stefferber

@stefferber thanks for your work on this. There is some stuff already in the recipees section of the documentation and i will look to add some of this to it so that it is all together.

As a side note, you have to select an entity relating to the car you want to control as the integration can work with multiple vehicles on the same JLR account.

msp1974 avatar May 07 '21 22:05 msp1974

still experimenting how to make a nice family dashboard. EVs need more "home care" regarding charging and pre-conditioning ;-) Lot's of copying from other HA dashboards. Here is my current UI: Bildschirmfoto 2021-05-08 um 10 13 13

type: picture-elements
image: /local/ipace.png
style: |
  #root > hui-image {
    display: block;
    width: 80%;
    top: 10px;
    padding: 0px 0px 30px 0px;
    margin: auto;
  }
elements:
  - type: image
    image: /local/cardbackK.png
    style:
      left: 50%
      top: 90%
      width: 100%
      height: 60px
  - type: state-icon
    entity: lock.jaguar_doors
    tap_action: more_info
    style:
      color: white
      left: 10%
      top: 86%
  - type: state-label
    entity: lock.jaguar_doors
    style:
      color: white
      left: 10%
      top: 95%
  - type: state-icon
    entity: sensor.jaguar_ev_battery
    tap_action: more_info
    style:
      color: white
      left: 30%
      top: 86%
  - type: state-label
    entity: sensor.jaguar_ev_battery
    style:
      color: white
      left: 30%
      top: 95%
  - type: state-icon
    entity: sensor.jaguar_ev_battery
    tap_action: more_info
    style:
      color: white
      left: 50%
      top: 86%
  - type: state-label
    entity: sensor.jaguar_ev_battery
    attribute: Minutes To Full Charge
    style:
      color: white
      left: 50%
      top: 95%
  - type: state-icon
    entity: sensor.jaguar_service_info
    tap_action: more_info
    style:
      color: white
      left: 70%
      top: 86%
  - type: state-label
    entity: sensor.jaguar_service_info
    attribute: Distance To Service
    style:
      color: white
      left: 70%
      top: 95%
  - type: state-icon
    entity: device_tracker.jaguar_device_tracker
    tap_action: more_info
    style:
      color: white
      left: 90%
      top: 86%
  - type: state-label
    entity: device_tracker.jaguar_device_tracker
    style:
      color: white
      left: 90%
      top: 95%
  - type: 'custom:circle-sensor-card'
    entity: sensor.jaguar_battery
    max: '100'
    min: '0'
    stroke_width: '15'
    gradient: 'true'
    fill: null
    name: Batterie
    units: '%'
    font_style:
      font-size: 1.0em
      font-color: white
      text-shadow: 1px 1px black
    style:
      top: 5%
      left: 80%
      width: 4em
      height: 4em
      transform: none
  - type: 'custom:circle-sensor-card'
    entity: sensor.jaguar_range
    max: '400'
    min: '0'
    stroke_width: '15'
    gradient: 'true,'
    fill: null
    name: Reichw
    units: km
    font_style:
      font-size: 1.0em
      font-color: white
      text-shadow: 1px 1px black
    style:
      top: 5%
      left: 5%
      width: 4em
      height: 4em
      transform: none

type: button
show_icon: true
icon: 'mdi:fan'
name: Starte Jaguar Klimaanlage 21°
show_state: true
tap_action:
  action: call-service
  service: jlrincontrol.start_preconditioning
  service_data:
    entity_id: sensor.jaguar_info
    target_temp: 21
  target: {}
hold_action:
  action: none
entity: sensor.jaguar_info

stefferber avatar May 08 '21 08:05 stefferber