Fehler in Yaml?

Muhkuh666

Member
Hallo und guten Morgen, kann mir bitte jemand helfen und Tipps geben wo hier noch Fehler sind? Der Codechecker sagt alles ist i.O.
Code:
# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

# Text to speech
tts:
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

sensor:
# Foxess
  - platform: 12345
    username: 12345
    password: 12345
    deviceID: 12345

# MyStrom Switch
  - platform: rest
    name: "mystrom_power"
    resource: http://192.168.2.123/report
    method: GET
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    value_template: "{{ value_json.power }}"

  - platform: rest
    name: "mystrom_temp"
    resource: http://192.168.2.123/report
    method: GET
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    value_template: "{{ value_json.temperature | round(1) }}"
    
  - platform: rest
    name: "mystrom_power1"
    resource: http://192.168.2.123/report
    method: GET
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    value_template: "{{ value_json.Ws }}"

midea_dehumidifier:
  username: 12345
  password: 12345

# put this in your configuration.yaml to get sensor data from powerfox.de
rest:
  - resource: http://192.168.2.128/rpc
    method: POST
    payload: '{"id":1,"jsonrpc":"2.0","method":"getConfig","params":{"key":"latest_data"}}'
    scan_interval: 10
    headers:
      Content-Type: application/json
    sensor:
      - name: "poweropti_local"
        json_attributes:
          - "jsonrpc"
          - "id"
          - "result"
        value_template: >
            {% set json = value_json.result | base64_decode %}
            {% set Timestmp = (json | from_json())[0].t %}
            {% set zaehlernummer = (json | from_json())[0].m %}
            {% set A_Plus = (json | from_json())[0].d[0].v %}
            {% set A_Plus_HT = (json | from_json())[0].d[1].v %}
            {% set A_Plus_NT = (json | from_json())[0].d[2].v %}
            {% set A_Minus = (json | from_json())[0].d[3].v %}
            {% set timestmp2 = (json | from_json())[1].t %}
            {% set watt = (json | from_json())[1].d[0].v %}
            {{ '{"Watt":' + (watt | string)  + ',"Timestamp":' + (Timestmp | string)  + ',"A_Plus":' + (((A_Plus | float) / 1000) | string) + ',"A_Minus":' + (((A_Minus | float) / 1000) | string) + '}' }}
template:
  - sensor:
      - name: "Strom aktuell"
        unit_of_measurement: "W"
        device_class: "power"
        state_class: "measurement"
        state: >
            {{ (states('sensor.poweropti_local')|from_json).Watt }}
      - name: "Strom Bezug"
        unit_of_measurement: "kWh"
        device_class: "energy"
        state_class: "total_increasing"
        state: >
            {{ (states('sensor.poweropti_local')|from_json).A_Plus }}
      - name: "Strom-Netz-Lieferung"
        unit_of_measurement: "kWh"
        device_class: "energy"
        state_class: "total_increasing"
        state: >
            {{ (states('sensor.poweropti_local')|from_json).A_Minus }}
            
# MyStrom Switch
switch:
  - platform: mystrom
    host: 192.168.2.123
 
Was gibt es denn für ein Problem / eine Fehlermeldung?

Auf Anhieb wäre ich mir nicht sicher, ob die Großschreibung bei value_json.Ws richtig ist - wäre eher ungewöhnlich, aber natürlich nicht ausgeschlossen - und value_template: > müsste eventuell dank der mehrzeiligen Angabe zu value_template: >- umgeschrieben werden.
 
Was gibt es denn für ein Problem / eine Fehlermeldung?

Auf Anhieb wäre ich mir nicht sicher, ob die Großschreibung bei value_json.Ws richtig ist - wäre eher ungewöhnlich, aber natürlich nicht ausgeschlossen - und value_template: > müsste eventuell dank der mehrzeiligen Angabe zu value_template: >- umgeschrieben werden.
Hallo Nival, vielen Dank, da ich absoluter Rookie bin, wie müsste es umgeschrieben werden?
 
Einfach nur das Minus dahintersetzen.

Trotzdem wäre es hilfreich zu wissen, weshalb Du davon ausgehst / weißt, dass hier noch Fehler bestehen ;)
 
Kein Fehler, aber Passwörter würde ich in die secrets.yaml schreiben, dann hat man die Zentral und braucht auch keine Bedenken haben, hier mal Code zu posten, ohne alle Passwörter preiszugeben.
 
Hallo nochmal.

ich bin etwas überfragt wie ich in die Yaml oben folgendes richtig einbinden muss: Danke für die Hilfe, ich bin Anfänger.


Code:
# Setup Better Solar Tracking Sensors that resolve negative solar tracking 

  - platform: integration
    source: sensor.foxess_pv1_power
    name: pv1_sum
    unit_time: h
    round: 2
  - platform: integration
    source: sensor.foxess_pv2_power
    name: pv2_sum
    unit_time: h
    round: 2
    
# Setup Daily and real-time solar trackers that resolve the negative solar tracking   

utility_meter:
    daily_pv1_sum:
        source: sensor.pv1_sum
        cycle: daily
 
    daily_pv2_sum:
        source: sensor.pv2_sum
        cycle: daily
        
# Setup Daily and real-time solar trackers that resolve the negative solar tracking   
      
template:
  - sensor:
      - name: "Solar Power Daily"
        unit_of_measurement: "kWh"
        state: "{{ states('sensor.daily_pv1_sum') | float + states('sensor.daily_pv2_sum') | float }}"
 
      - name: "Solar Power Now"
        unit_of_measurement: "kW"
        state: "{{ states('sensor.foxess_pv1_power') | float + states('sensor.foxess_pv2_power') | float }}"
 
auf den ersten Blick würde dies so passen, wo ich aktuell nicht ganz sicher bin ist bei # Foxess da

YAML:
sensor:
# Foxess
.
.
.
  - platform: integration
    source: sensor.foxess_pv1_power
    name: pv1_sum
    unit_time: h
    round: 2
  - platform: integration
    source: sensor.foxess_pv2_power
    name: pv2_sum
    unit_time: h
    round: 2

so im kompletten...

YAML:
# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

# Text to speech
tts:
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

# Setup Daily and real-time solar trackers that resolve the negative solar tracking  
utility_meter:
  daily_pv1_sum:
    source: sensor.pv1_sum
    cycle: daily
  daily_pv2_sum:
    source: sensor.pv2_sum
    cycle: daily

sensor:
# Foxess
  - platform: 12345
    username: 12345
    password: 12345
    deviceID: 12345
  - platform: integration
    source: sensor.foxess_pv1_power
    name: pv1_sum
    unit_time: h
    round: 2
  - platform: integration
    source: sensor.foxess_pv2_power
    name: pv2_sum
    unit_time: h
    round: 2

midea_dehumidifier:
  username: 12345
  password: 12345

# put this in your configuration.yaml to get sensor data from powerfox.de
rest:
  - resource: 'http://192.168.2.128/rpc'
    method: POST
    payload: >-
      {"id":1,"jsonrpc":"2.0","method":"getConfig","params":{"key":"latest_data"}}
    scan_interval: 10
    headers:
      Content-Type: application/json
    sensor:
      - name: poweropti_local
        json_attributes:
          - jsonrpc
          - id
          - result
        value_template: >
          {% set json = value_json.result | base64_decode %} {% set Timestmp =
          (json | from_json())[0].t %} {% set zaehlernummer = (json |
          from_json())[0].m %} {% set A_Plus = (json | from_json())[0].d[0].v %}
          {% set A_Plus_HT = (json | from_json())[0].d[1].v %} {% set A_Plus_NT
          = (json | from_json())[0].d[2].v %} {% set A_Minus = (json |
          from_json())[0].d[3].v %} {% set timestmp2 = (json | from_json())[1].t
          %} {% set watt = (json | from_json())[1].d[0].v %} {{ '{"Watt":' +
          (watt | string)  + ',"Timestamp":' + (Timestmp | string)  +
          ',"A_Plus":' + (((A_Plus | float) / 1000) | string) + ',"A_Minus":' +
          (((A_Minus | float) / 1000) | string) + '}' }}

# MyStrom Switch
  - resource: 'http://192.168.2.123/report'
    name: mystrom_power
    method: GET
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    value_template: '{{ value_json.power }}'
  - resource: 'http://192.168.2.123/report'
    name: mystrom_temp
    method: GET
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    value_template: '{{ value_json.temperature | round(1) }}'
  - resource: 'http://192.168.2.123/report'
    name: mystrom_power1
    method: GET
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    value_template: '{{ value_json.Ws }}'
   
template:
  - sensor:
      - name: Strom aktuell
        unit_of_measurement: W
        device_class: power
        state_class: measurement
        state: |
          {{ (states('sensor.poweropti_local')|from_json).Watt }}
      - name: Strom Bezug
        unit_of_measurement: kWh
        device_class: energy
        state_class: total_increasing
        state: |
          {{ (states('sensor.poweropti_local')|from_json).A_Plus }}
      - name: Strom-Netz-Lieferung
        unit_of_measurement: kWh
        device_class: energy
        state_class: total_increasing
        state: |
          {{ (states('sensor.poweropti_local')|from_json).A_Minus }}
      - name: "Solar Power Daily"
        unit_of_measurement: "kWh"
        state: "{{ states('sensor.daily_pv1_sum') | float + states('sensor.daily_pv2_sum') | float }}"
      - name: "Solar Power Now"
        unit_of_measurement: "kW"
        state: "{{ states('sensor.foxess_pv1_power') | float + states('sensor.foxess_pv2_power') | float }}"
           
# MyStrom Switch
switch:
  - platform: mystrom
    host: 192.168.2.123
 
Zuletzt bearbeitet:
auf den ersten Blick würde dies so passen, wo ich aktuell nicht ganz sicher bin ist bei # Foxess da

YAML:
sensor:
# Foxess
.
.
.
  - platform: integration
    source: sensor.foxess_pv1_power
    name: pv1_sum
    unit_time: h
    round: 2
  - platform: integration
    source: sensor.foxess_pv2_power
    name: pv2_sum
    unit_time: h
    round: 2

so im kompletten...

YAML:
# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

# Text to speech
tts:
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

# Setup Daily and real-time solar trackers that resolve the negative solar tracking 
utility_meter:
  daily_pv1_sum:
    source: sensor.pv1_sum
    cycle: daily
  daily_pv2_sum:
    source: sensor.pv2_sum
    cycle: daily

sensor:
# Foxess
  - platform: 12345
    username: 12345
    password: 12345
    deviceID: 12345
  - platform: integration
    source: sensor.foxess_pv1_power
    name: pv1_sum
    unit_time: h
    round: 2
  - platform: integration
    source: sensor.foxess_pv2_power
    name: pv2_sum
    unit_time: h
    round: 2

midea_dehumidifier:
  username: 12345
  password: 12345

# put this in your configuration.yaml to get sensor data from powerfox.de
rest:
  - resource: 'http://192.168.2.128/rpc'
    method: POST
    payload: >-
      {"id":1,"jsonrpc":"2.0","method":"getConfig","params":{"key":"latest_data"}}
    scan_interval: 10
    headers:
      Content-Type: application/json
    sensor:
      - name: poweropti_local
        json_attributes:
          - jsonrpc
          - id
          - result
        value_template: >
          {% set json = value_json.result | base64_decode %} {% set Timestmp =
          (json | from_json())[0].t %} {% set zaehlernummer = (json |
          from_json())[0].m %} {% set A_Plus = (json | from_json())[0].d[0].v %}
          {% set A_Plus_HT = (json | from_json())[0].d[1].v %} {% set A_Plus_NT
          = (json | from_json())[0].d[2].v %} {% set A_Minus = (json |
          from_json())[0].d[3].v %} {% set timestmp2 = (json | from_json())[1].t
          %} {% set watt = (json | from_json())[1].d[0].v %} {{ '{"Watt":' +
          (watt | string)  + ',"Timestamp":' + (Timestmp | string)  +
          ',"A_Plus":' + (((A_Plus | float) / 1000) | string) + ',"A_Minus":' +
          (((A_Minus | float) / 1000) | string) + '}' }}

# MyStrom Switch
  - resource: 'http://192.168.2.123/report'
    name: mystrom_power
    method: GET
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    value_template: '{{ value_json.power }}'
  - resource: 'http://192.168.2.123/report'
    name: mystrom_temp
    method: GET
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    value_template: '{{ value_json.temperature | round(1) }}'
  - resource: 'http://192.168.2.123/report'
    name: mystrom_power1
    method: GET
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    value_template: '{{ value_json.Ws }}'
  
template:
  - sensor:
      - name: Strom aktuell
        unit_of_measurement: W
        device_class: power
        state_class: measurement
        state: |
          {{ (states('sensor.poweropti_local')|from_json).Watt }}
      - name: Strom Bezug
        unit_of_measurement: kWh
        device_class: energy
        state_class: total_increasing
        state: |
          {{ (states('sensor.poweropti_local')|from_json).A_Plus }}
      - name: Strom-Netz-Lieferung
        unit_of_measurement: kWh
        device_class: energy
        state_class: total_increasing
        state: |
          {{ (states('sensor.poweropti_local')|from_json).A_Minus }}
      - name: "Solar Power Daily"
        unit_of_measurement: "kWh"
        state: "{{ states('sensor.daily_pv1_sum') | float + states('sensor.daily_pv2_sum') | float }}"
      - name: "Solar Power Now"
        unit_of_measurement: "kW"
        state: "{{ states('sensor.foxess_pv1_power') | float + states('sensor.foxess_pv2_power') | float }}"
          
# MyStrom Switch
switch:
  - platform: mystrom
    host: 192.168.2.123
Hallo, so werden die Foxess Sensoren leider nicht geladen :(
 
YAML:
  - platform: 12345
    username: 12345
    password: 12345
    deviceID: 12345

Da hast du deine richtigen Daten eingetragen?

Ich würde diese Daten ja in der secrets.yaml schreiben, also in der configuration.yaml

YAML:
sensor:
  - platform: foxess
    username: !secret foxesscloud_username
    password: !secret foxesscloud_password
    deviceID: !secret foxesscloud_inverter_id

und in der secrets.yaml
YAML:
foxesscloud_username: "dein username"
foxesscloud_password: "dein Passwort"
foxesscloud_inverter_id: "deine ID"
dann kannst du nämlich deine configuration.yaml posten, ohne passwörter auszuxxen zu müssen.

...ansonsten mal den loglevel anheben, das du mehr Fehler siehst
YAML:
logger:
  default: warning
  logs:
    custom_components.foxess: debug
 

Zurzeit aktive Besucher

Letzte Anleitungen

Statistik des Forums

Themen
6.110
Beiträge
59.382
Mitglieder
6.151
Neuestes Mitglied
swoopy
Zurück
Oben