Skip to content

DasBasti/SmartHashtag

Repository files navigation

Smart #1 and #3 Integration

GitHub Release License CodeQL Validation Dependency Validation

Installation

Using HACS (Recommended)

  1. Add this repository to your custom repositories
  2. Search for and install "Smart #1/#3 Integration" in HACS.
  3. Restart Home Assistant.
  4. In the Home Assistant UI go to "Configuration" -> "Integrations" click "+" and search for "Smart"

Manually Copy Files

  1. Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml).
  2. If you do not have a custom_components directory (folder) there, you need to create it.
  3. In the custom_components directory (folder) create a new folder called smarthashtag.
  4. Download all the files from the custom_components/smarthashtag/ directory (folder) in this repository.
  5. Place the files you downloaded in the new directory (folder) you created.
  6. Restart Home Assistant
  7. In the Home Assistant UI go to "Configuration" -> "Integrations" click "+" and search for "Smart"

Finally

Open your Home Assistant instance and start setting up a new integration.

Connect to ABRP

@chriscatuk integrated A Better Route Planner with data from this component. To automatically send the information everytime the component updates, add this to your automations.

# based on https://documenter.getpostman.com/view/7396339/SWTK5a8w
alias: ABRP update
description: ""
triggers:
  - entity_id:
      - sensor.smart_last_update
    trigger: state
conditions: []
actions:
  - action: rest_command.abrp
    data:
      token: 99999999-aaaa-aaaa-bbbb-eeeeeeeeee # generated for each car in ABRP app
      api_key: 8888888-2222-44444-bbbb-333333333 # obtained from contact@iternio.com , see https://documenter.getpostman.com/view/7396339/SWTK5a8w
      utc: "{{ as_timestamp(states('sensor.smart_last_update')) | int }}"
      soc: >-
        {{ states('sensor.smart_battery', rounded=False, with_unit=False) |
        default('') }}
      soh: 100
      power: >
        {% if states('sensor.smart_charging_power', rounded=False,
        with_unit=False) | default(0) | float > 0 %}
            -{{ states('sensor.smart_charging_power', rounded=False, with_unit=False) | int / 1000 }}
        {% endif %}
      speed: ""
      lat: "{{ state_attr('device_tracker.smart_none', 'latitude') | default('') }}"
      lon: "{{ state_attr('device_tracker.smart_none', 'longitude') | default('') }}"
      elevation: >-
        {{ state_attr('device_tracker.smart_none', 'altitude').value |
        default('') }}
      is_charging: >
        {% if states('sensor.smart_charging_status') == 'charging' or
        states('sensor.smart_charging_status') == 'DC charging' %}
            1
        {% else %}
            0
        {% endif %}
      is_dcfc: |
        {% if states('sensor.smart_charging_status') == 'DC charging' %}
            1
        {% else %}
            0
        {% endif %}
      is_parked: "{{ states('sensor.smart_electric_park_brake_status') | default(0) }}"
      ext_temp: >-
        {{ states('sensor.smart_exterior_temperature', rounded=False,
        with_unit=False) | default('') }}
      odometer: >-
        {{ states('sensor.smart_odometer', rounded=False, with_unit=False) |
        default('') }}
      est_battery_range: >-
        {{ states('sensor.smart_range', rounded=False, with_unit=False) |
        default('') }}
mode: single

And this to your configuration.yaml to create the rest_command.

rest_command:
  abrp:
    url: https://api.iternio.com/1/tlm/send?token={{ token }}&tlm={"utc":"{{ utc }}","soc":"{{ soc }}","soh":"{{ soh }}","power":"{{ power }}","speed":"{{ speed }}","lat":"{{ lat }}","lon":"{{ lon }}","is_charging":"{{ is_charging }}","is_dcfc":"{{ is_dcfc }}","is_parked":"{{ is_parked }}","elevation":"{{ elevation }}","ext_temp":"{{ ext_temp }}","odometer":"{{ odometer }}","est_battery_range":"{{ est_battery_range }}"}
    method: post
    headers:
      Authorization: "APIKEY {{ api_key }}"

Contributions are welcome!

We need to add more sensor values from the JSON aquired form the Web API. Please have a look at pySmartHashtag. If you want to contribute to this please read the Contribution guidelines


Project Maintenance