Skip to content

DasBasti/SmartHashtag

Repository files navigation

Smart #1, #3 and #5 Integration

GitHub Release License CodeQL Validation Dependency Validation

Installation

Using HACS (Recommended)

  1. Search for and install "Smart #1/#3/#5 Integration" in HACS.
  2. Restart Home Assistant.
  3. 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. You can download from the current Release
  5. Extract 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:
  - condition: template
    value_template: "{{ states('sensor.smart_last_update') not in ['unavailable', 'unknown'] }}"
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 }}
        {% else %}
        0
        {% endif %}
      lat: >-
        {{ state_attr('device_tracker.smart_none', 'latitude') |
        default('null') }}
      lon: >-
        {{ state_attr('device_tracker.smart_none', 'longitude') |
        default('null') }}
      elevation: >-
        {{ state_attr('device_tracker.smart_none', 'altitude').value |
        default('null') }}
      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: |
        {% if states('binary_sensor.smart_electric_park_brake_status') == 'off' %}
            1
        {% else %}
            0
        {% endif %}
      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: # As documented in https://documenter.getpostman.com/view/7396339/SWTK5a8w#fdb20525-51da-4195-8138-54deabe907d5
    url: https://api.iternio.com/1/tlm/send?token={{ token }}&tlm={"utc":{{ utc }},"soc":{{ soc }},"soh":{{ soh }},"power":{{ power }},"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 }}"

Connect to EVCC

EVCC is an extensible EV Charge Controller and home energy management system.

vehicles:
  - name: smart
    title: "Smart #1"
    type: homeassistant
    uri: http://homeassistant.local:8123
    token: "eyJ0e..." # HA-Token

    sensors:
      soc: sensor.smart_batterie # MANDATORY: SoC in %
      range: sensor.smart_reichweite # OPTIONAL: Range in km
      status: sensor.smart_ladezustand # OPTIONAL: Charging state
      limitSoc: number.smart_ladeziel # OPTIONAL: Charging limit in %
      odometer: sensor.smart_kilometerstand # OPTIONAL: Odometer in km
      climater: climate.smart_vorklimatisierung_aktiv # OPTIONAL: Aircon
      finishTime: sensor.smart_verbleibende_ladezeit # OPTIONAL: Chraing time remaining

    capacity: 62 # Capacity of the battery in kWh

The sensor finishTime should be a point in time, but it seems the time span of the sensor works as well.

AI-Assisted Development

This project uses AI tools to assist with development, including GitHub Copilot for code suggestions and commit message generation.

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

About

Homeassistant component for Smart #1/#3 API

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

  •  

Contributors