SAIC-API direkt ansteuern (iSmart App Alternative)

Re: SAIC-API direkt ansteuern (iSmart App Alternative)

c1olli
  • Beiträge: 231
  • Registriert: Di 8. Nov 2022, 17:27
  • Hat sich bedankt: 7 Mal
  • Danke erhalten: 71 Mal
read
Wenn das Auto an der Wallbox angeschlossen ist, hat EVCC Vorrang und haut dich nach spätestens einer Minute raus. Ist das Fahrzeug nicht angeschlossen dauert es wesentlich länger.
Den Gateway kann man parallel laufen lassen.
Gruß
Olli

MG 4 Comfort - Diamond Red
Anzeige

Re: SAIC-API direkt ansteuern (iSmart App Alternative)

Tonno87
  • Beiträge: 162
  • Registriert: So 16. Jan 2022, 23:10
  • Wohnort: Friesenhagen
  • Hat sich bedankt: 20 Mal
  • Danke erhalten: 30 Mal
read
Ich hab das Gateway als Add-on laufen und nutze die MG2mqtt integration bei evcc. Man muss dann nur einstellen das der Fahrzeugzustand nach dem Einstecken regelmäßig abgefragt wird, sonst kann evcc den soc nicht abrufen und auch dir Vorwärmung nicht erkennen

Schaut mal hier, ist aber noch nicht fertig. Hab momentan keine Zeit irgendwas zu machen..

Wiki
PV: SMA Sunny Tripower 8.0 mit 9,92kWp
WB: Easee Charge Lite 11kW
Steuerung: Home Assistant + EVCC + Tibber (ab 01.03.2023)
Fahrzeug: MG5 SR Luxury Black

Re: SAIC-API direkt ansteuern (iSmart App Alternative)

USER_AVATAR
read
c1olli hat geschrieben: Den Gateway kann man parallel laufen lassen.
Okay, dann probiere ich es so, danke.
Tonno87 hat geschrieben: sonst kann evcc den soc nicht abrufen und auch dir Vorwärmung nicht erkennen
Vorwärmung erkennen brauche ich nicht, dann müsste ich auch so auskommen?

Re: SAIC-API direkt ansteuern (iSmart App Alternative)

c1olli
  • Beiträge: 231
  • Registriert: Di 8. Nov 2022, 17:27
  • Hat sich bedankt: 7 Mal
  • Danke erhalten: 71 Mal
read
Hallo,

das der Java Gateway ja obsolet ist, versuche ich gerade den Python Gateway auf meinem Raspberry Pi zum Laufen zu bekommen, aber das klappt nicht wirklich.
Python ist drauf, Respority ist geclont.

Wenn ich dann starten will kommt das:

Code: Alles auswählen

pi@raspberrypi:~ $ python saic-python-mqtt-gateway/mqtt_gateway.py -m tcp://192.168.178.115:1884 -u saic -p saic
  File "/home/pi/saic-python-mqtt-gateway/mqtt_gateway.py", line 164
    match topic:
          ^
SyntaxError: invalid syntax
statt saic stehen dort die Zugangsdaten. Was mache ich falsch?
Gruß
Olli

MG 4 Comfort - Diamond Red

Re: SAIC-API direkt ansteuern (iSmart App Alternative)

lucas2350d
  • Beiträge: 15
  • Registriert: Di 30. Aug 2022, 13:18
  • Hat sich bedankt: 5 Mal
  • Danke erhalten: 5 Mal
read
Hallo Andi,

Erstmal danke für das Bereitstellen des Dashboards. Ich bin leider ein kompletter Home Assistant Anfänger und bekomme es absolut nicht so kopiert, dass es funktioniert.
Könntest du mir eventuell Stichpunktartig beschreiben, wie ich den Code richtig in einem neuen Dashboard einfüge?
Vielen Dank

MasterAndi0815 hat geschrieben: Hallo zusammen,

zunächst mal vielen Dank an die Entwickler von dem Gateway und dem Home Assistant AddOn, Klasse Arbeit !!
Ich möchte im Gegenzug mein mobiles Dashboard für Home Assistant mit euch teilen.
Das Auto und der Kofferaum können geöffnet bzw. verschlossen werden.
Die Klimatisierung inkl. Sitzheizung, Batterie und Belüftung der Frontscheibe können gesteuert werden.
LadeLimit anpassen und auch das Laden beenden und starten ist möglich.
MG4 Dashboard Mobil.pngMG4 Dashboard Mobil 2.pngMG4 Dashboard Mobil 3.png

Es werden folgende Frontend Module im HACS benötigt:
  • button-card
  • Simple Thermostat
  • Tabbed Card

Code für das Dashboard:

Code: Alles auswählen

type: horizontal-stack
cards:
  - type: vertical-stack
    cards:
      - type: horizontal-stack
        cards:
          - type: custom:button-card
            template: infobar
            entity: sensor.lsjwhxxxxxxxxxxxx_soc
            icon: mdi:ev-station
            label: Ladezustand
            tap_action:
              action: none
            hold_action:
              action: none
            show_label: true
            name: |
              [[[
                return (entity.state + ' %')
              ]]]
          - type: custom:button-card
            template: info
            entity: sensor.lsjwhxxxxxxxxxxxx_range
            icon: null
            name: Reichweite
            tap_action:
              action: none
            hold_action:
              action: none
            numeric_precision: 0
      - type: custom:tabbed-card
        options: {}
        tabs:
          - card:
              type: grid
              columns: 2
              square: false
              cards:
                - type: custom:button-card
                  template: info
                  entity: sensor.lsjwhxxxxxxxxxxxx_mileage
                  icon: null
                  name: Gesamtkilometer
                  tap_action:
                    action: none
                  hold_action:
                    action: none
                  numeric_precision: 0
                - type: custom:button-card
                  template: info
                  entity: binary_sensor.lsjwhxxxxxxxxxxxx_lights_dipped_beam
                  icon: null
                  name: Licht
                  tap_action:
                    action: none
                  hold_action:
                    action: none
                - type: custom:button-card
                  template: info
                  entity: lock.lsjwhxxxxxxxxxxxx_doors_lock
                  icon: null
                  name: Türen
                  state:
                    - value: unlocked
                      icon: mdi:car-door-lock-open
                  tap_action:
                    action: call-service
                    service: |
                      [[[
                        return (entity.state === 'locked')?'lock.unlock':'lock.lock';
                      ]]]
                    service_data:
                      entity_id: lock.lsjwhxxxxxxxxxxxx_doors_lock
                  hold_action:
                    action: none
                - type: custom:button-card
                  template: info
                  entity: lock.lsjwhxxxxxxxxxxxx_boot_lock
                  icon: null
                  name: Kofferraum
                  state:
                    - value: unlocked
                      icon: mdi:car-door-lock-open
                  tap_action:
                    action: call-service
                    service: |
                      [[[
                        return (entity.state === 'locked')?'lock.unlock':'lock.lock';
                      ]]]
                    service_data:
                      entity_id: lock.lsjwhxxxxxxxxxxxx_boot_lock
                  hold_action:
                    action: none
                - type: custom:button-card
                  template: info
                  entity: sensor.lsjwhxxxxxxxxxxxx_auxiliary_battery_voltage
                  icon: null
                  name: 12V Batterie
                  tap_action:
                    action: none
                  hold_action:
                    action: none
                  state:
                    - value: 12
                      operator: <
                      color: red
                - type: custom:button-card
                  template: info
                  entity: sensor.lsjwhxxxxxxxxxxxx_voltage
                  icon: null
                  name: HV Batterie
                  tap_action:
                    action: none
                  hold_action:
                    action: none
                - type: custom:button-card
                  template: info
                  entity: sensor.lsjwhxxxxxxxxxxxx_tyres_front_left_pressure
                  icon: null
                  name: Reifendruck Vorne Links
                  tap_action:
                    action: none
                  hold_action:
                    action: none
                - type: custom:button-card
                  template: info
                  entity: sensor.lsjwhxxxxxxxxxxxx_tyres_front_right_pressure
                  icon: null
                  name: Reifendruck Vorne Rechts
                  tap_action:
                    action: none
                  hold_action:
                    action: none
                - type: custom:button-card
                  template: info
                  entity: sensor.lsjwhxxxxxxxxxxxx_tyres_rear_left_pressure
                  icon: null
                  name: Reifendruck Hinten Links
                  tap_action:
                    action: none
                  hold_action:
                    action: none
                - type: custom:button-card
                  template: info
                  entity: sensor.lsjwhxxxxxxxxxxxx_tyres_rear_right_pressure
                  icon: null
                  name: Reifendruck Hinten Rechts
                  tap_action:
                    action: none
                  hold_action:
                    action: none
            attributes:
              label: Info
          - card:
              type: grid
              columns: 1
              square: false
              cards:
                - type: custom:simple-thermostat
                  entity: climate.lsjwhxxxxxxxxxxxx_vehicle_climate
                  header: false
                  layout:
                    mode:
                      names: true
                      icons: true
                      headings: false
                - type: grid
                  columns: 2
                  square: false
                  cards:
                    - type: custom:button-card
                      template: info
                      entity: select.lsjwhxxxxxxxxxxxx_heated_seat_front_left_level
                      icon: null
                      name: Sitzheizung Fahrer
                      tap_action:
                        action: call-service
                        service: select.select_option
                        target:
                          entity_id: >-
                            select.lsjwhxxxxxxxxxxxx_heated_seat_front_left_level
                        service_data:
                          option: |
                            [[[
                              return (entity.state === 'OFF')?'HIGH':'OFF';
                            ]]]
                      hold_action:
                        action: none
                    - type: custom:button-card
                      template: info
                      entity: select.lsjwhxxxxxxxxxxxx_heated_seat_front_right_level
                      icon: null
                      name: Sitzheizung Beifahrer
                      tap_action:
                        action: call-service
                        service: select.select_option
                        target:
                          entity_id: >-
                            select.lsjwhxxxxxxxxxxxx_heated_seat_front_right_level
                        service_data:
                          option: |
                            [[[
                              return (entity.state === 'OFF')?'HIGH':'OFF';
                            ]]]                          
                      hold_action:
                        action: none
                    - type: custom:button-card
                      template: info
                      entity: switch.lsjwhxxxxxxxxxxxx_battery_heating
                      icon: null
                      name: Batterieheizung
                      tap_action:
                        action: toggle
                      hold_action:
                        action: none
                    - type: custom:button-card
                      template: info
                      entity: switch.lsjwhxxxxxxxxxxxx_front_window_defroster_heating
                      icon: null
                      name: Frontscheibe auftauen
                      tap_action:
                        action: toggle
                      hold_action:
                        action: none
            attributes:
              label: Klimatisierung
          - card:
              type: grid
              columns: 2
              square: false
              cards:
                - type: custom:button-card
                  template: info
                  entity: switch.lsjwhxxxxxxxxxxxx_charging
                  icon: null
                  name: Laden beenden
                  tap_action:
                    action: toggle
                  hold_action:
                    action: none
                - type: custom:button-card
                  template: info
                  entity: binary_sensor.lsjwhxxxxxxxxxxxx_battery_charging
                  icon: null
                  name: Ladevorgang
                  tap_action:
                    action: none
                  hold_action:
                    action: none
                - type: custom:button-card
                  template: info
                  entity: binary_sensor.lsjwhxxxxxxxxxxxx_charger_connected
                  icon: null
                  name: Ladekabel
                  tap_action:
                    action: none
                  hold_action:
                    action: none
                - type: custom:button-card
                  template: info
                  entity: sensor.lsjwhxxxxxxxxxxxx_remaining_charging_time
                  icon: null
                  name: Verbleibende Ladezeit
                  tap_action:
                    action: none
                  hold_action:
                    action: none
                - type: custom:button-card
                  template: info
                  entity: sensor.lsjwhxxxxxxxxxxxx_soc_kwh
                  icon: null
                  name: Ladestand in kWh
                  tap_action:
                    action: none
                  hold_action:
                    action: none
                - type: custom:button-card
                  template: info
                  entity: sensor.lsjwhxxxxxxxxxxxx_power
                  icon: null
                  name: Leistung
                  tap_action:
                    action: none
                  hold_action:
                    action: none
                - type: grid
                  columns: 2
                  square: false
                  cards:
                    - type: custom:button-card
                      entity: number.lsjwhxxxxxxxxxxxx_target_soc
                      name: 70%
                      tap_action:
                        action: call-service
                        service: number.set_value
                        target:
                          entity_id: number.lsjwhxxxxxxxxxxxx_target_soc
                        data:
                          value: 70
                      hold_action:
                        action: none
                      state:
                        - value: 70
                          color: green
                    - type: custom:button-card
                      entity: number.lsjwhxxxxxxxxxxxx_target_soc
                      name: 80%
                      tap_action:
                        action: call-service
                        service: number.set_value
                        target:
                          entity_id: number.lsjwhxxxxxxxxxxxx_target_soc
                        data:
                          value: 80
                      hold_action:
                        action: none
                      state:
                        - value: 80
                          color: green
                - type: grid
                  columns: 2
                  square: false
                  cards:
                    - type: custom:button-card
                      entity: number.lsjwhxxxxxxxxxxxx_target_soc
                      name: 90%
                      tap_action:
                        action: call-service
                        service: number.set_value
                        target:
                          entity_id: number.lsjwhxxxxxxxxxxxx_target_soc
                        data:
                          value: 90
                      hold_action:
                        action: none
                      state:
                        - value: 90
                          color: green
                    - type: custom:button-card
                      entity: number.lsjwhxxxxxxxxxxxx_target_soc
                      name: 100%
                      tap_action:
                        action: call-service
                        service: number.set_value
                        target:
                          entity_id: number.lsjwhxxxxxxxxxxxx_target_soc
                        data:
                          value: 100
                      hold_action:
                        action: none
                      state:
                        - value: 100
                          color: green
            attributes:
              label: Laden
Button Templates über den Dashboard RAW-Konfigurationseditor am Anfang einfügen:

Code: Alles auswählen

button_card_templates:
  infobar:
    custom_fields:
      bar: |
        [[[
          var color = "red";
          var state = entity.state;
          if (state > 40) color = "green";
          else if (state > 15) color = "orange";

          return `
          <div>
          <div style="background:${color}; height: 12px; width:${state}%">
          </div>
          </div>
          `
        ]]]
    styles:
      custom_fields:
        bar:
          - justify-self: start
          - width: 100%
          - height: 12px
          - background: '#cccccc'
      grid:
        - grid-template-areas: '"i n" "bar bar" "l l"'
      card:
        - padding: 20px
      img_cell:
        - justify-self: start
        - width: 24px
        - height: 24px
        - padding-bottom: 0px
        - margin-left: '-3px'
      icon:
        - width: 24px
        - color: black
      label:
        - justify-self: start
        - font-size: 16px
        - padding: 2px 0
      name:
        - justify-self: end
        - font-size: 16px
        - font-weight: 500
  info:
    show_state: true
    layout: icon_state
    styles:
      card:
        - padding: 20px
      img_cell:
        - justify-self: start
        - width: 24px
        - height: 24px
        - padding-bottom: 14px
        - margin-left: '-3px'
      icon:
        - width: 24px
      name:
        - justify-self: start
        - font-size: 16px
        - padding: 2px 0
      state:
        - justify-self: end
        - font-size: 16px
        - font-weight: 500
Viel Spass damit
Grüße
MasterAndi

Re: SAIC-API direkt ansteuern (iSmart App Alternative)

tw3aker
  • Beiträge: 10
  • Registriert: So 21. Aug 2022, 17:05
  • Danke erhalten: 1 Mal
read
Hallo zusammen,

habe letzte Woche es hin bekommen, meinen MG 5 in home assistant zu integrieren über das SAIC addon.
Jetzt habe ich mir die Frage gestellt, ob es möglich ist, weitere Daten abzurufen, und wenn ja wie? Mit mqtt etc habe ich bisher keinerlei Erfahrung.

Liebe Grüße
Bastian

Re: SAIC-API direkt ansteuern (iSmart App Alternative)

lucas2350d
  • Beiträge: 15
  • Registriert: Di 30. Aug 2022, 13:18
  • Hat sich bedankt: 5 Mal
  • Danke erhalten: 5 Mal
read
@OliverE
was genau hast du gemacht, damit das Dashboard funktioniert?
Ich habe probiert den Code einzufügen und die Fahrgestellnummer anzupassen aber leider bleibt die Seite leer.
OliverE hat geschrieben: @MasterAndi0815
Ich habe es soweit jetzt hinbekommen.
Ist es möglich bei der Button Beschriftung einen Zeilenumbruch zu machen oder die Schrift zu Skalieren das es komplett lesbar ist?

IMG_5960.png

Re: SAIC-API direkt ansteuern (iSmart App Alternative)

MasterAndi0815
  • Beiträge: 25
  • Registriert: Di 19. Jan 2021, 17:28
  • Hat sich bedankt: 58 Mal
  • Danke erhalten: 26 Mal
read
@lucas2350d
Wird dein MG normal unter Einstellungen/Geräte/MQTT angezeigt ?
Dann dort z.B. mal die SOC Entität aufrufen und dann oben auf das Zahnrad klicken. Nun werden die Details angezeigt und auch die Entitäts-ID.
Diese nun kopieren und dann im Dashboard an der entsprechenden Stelle einfügen.
Nun kannst du sehen, ob es ausreicht die VIN anzupassen oder ob deine ID anders aufgebaut ist, in diesem Fall müssten alle Entitäten auf diesem Weg angepasst werden.

Für das Dashboard werden ein paar weitere Erweiterungen benötigt, sind diese installiert ?
Es werden folgende Frontend Module im HACS benötigt:
button-card
Simple Thermostat
Tabbed Card

Das Template für das Button Design muss mit dem RAW Editor ganz am Anfang vor das Dashboard eingefügt werden.
Skoda Enyaq iV80 09/2021 / Quarz-Grau Metallic / Loft / 19"er / AHK / keine WP.
SAIC MG4 02/2023 / Luxury / Medal Silver.

Re: SAIC-API direkt ansteuern (iSmart App Alternative)

tw3aker
  • Beiträge: 10
  • Registriert: So 21. Aug 2022, 17:05
  • Danke erhalten: 1 Mal
read
Ich bekomme den leider nicht via mqtt angezeigt. Lediglich die in der configuration.yaml angelegten Sensoren liefern mir werte.
Wenn ich den localhost:42042 öffne, bekomme ich "API error" angezeigt.
Dennoch liefert mir das Add-on die Werte vom Auto.
Wie kann ich weiter vorgehen?

Liebe Grüße

Bastian

Re: SAIC-API direkt ansteuern (iSmart App Alternative)

MasterAndi0815
  • Beiträge: 25
  • Registriert: Di 19. Jan 2021, 17:28
  • Hat sich bedankt: 58 Mal
  • Danke erhalten: 26 Mal
read
Es gibt in der API Config zwei Werte für das HomeAssistant AutoDiscovery:
--ha-discovery HA_DISCOVERY_ENABLED Home Assistant auto-discovery is enabled (True) by default. It can be disabled (False) with this parameter.
--ha-discovery-prefix HA_DISCOVERY_PREFIX The default MQTT prefix for Home Assistant auto-discovery is 'homeassistant'. Another prefix can be configured with this parameter

Damit wird der MG eigentlich automatisch hinzugefügt.
Skoda Enyaq iV80 09/2021 / Quarz-Grau Metallic / Loft / 19"er / AHK / keine WP.
SAIC MG4 02/2023 / Luxury / Medal Silver.
Anzeige
AntwortenAntworten

Zurück zu „MG5 Electric - Allgemeine Themen“

Gehe zu Profile
  • Vergleichbare Themen
    Antworten
    Zugriffe
    Letzter Beitrag