sdesalve / zcsazzurro

ZCSAzzurro by SDeSalve
Other
35 stars 12 forks source link

Sensori senza Valore #20

Closed FranFabi closed 1 year ago

FranFabi commented 1 year ago

Salve, dopo aver installato l'integrazione e creato i sensori mi trovo nella situazione come in foto. In pratica tutti i sensori sono vuoti. Image 001

Quale potrebbe essere il problema ?

sdesalve commented 1 year ago

Nel log c'è scritto il problema...

FranFabi commented 1 year ago

Grazie della risposta, ma non riesco a trovare niente nei log di HA

sdesalve commented 1 year ago

Metti/integra con il logger esistente nel tuo configuration.yaml

logger:
  default: error
  logs:
    homeassistant.components.rest: debug
    homeassistant.components.rest.data: debug
    custom_components.zcsazzurro: debug
    custom_components.zcsazzurro.sensor: debug
FranFabi commented 1 year ago

Grazie. In pratica non inviano niente loro a quanto ho capito.

Piero87 commented 1 year ago

@FranFabi io ho lo stesso problema come hai risolto?

sdesalve commented 1 year ago

@FranFabi io ho lo stesso problema come hai risolto?

I log che dicono? Che errore leggi?

Piero87 commented 1 year ago

Ciao @sdesalve, allora innanzi tutto questa è la mia configurazione:

configuration.yaml

homeassistant:
  packages: !include_dir_named packages

packages/fotovoltaico.yaml

sensor:
  - platform: zcsazzurro
    name: fotovoltaico
    thingkey: *********
    authkey: Zcs ******
    clientcode: ******

##### current
template:
  - sensor:
      - name: "Potenza Istantanea"
        unit_of_measurement: "W"
        state: >
          {% set power = state_attr('sensor.fotovoltaico','current')['powerGenerating'] | int(0) %}
          {{ power }}
        state_class: measurement
        device_class: power
        icon: mdi:solar-power

      - name: "Batteria"
        unit_of_measurement: "%"
        state: >
          {% set energy = state_attr('sensor.fotovoltaico','current')['batterySoC'] | float(0) %}
          {{ energy | round(2) }}
        state_class: measurement
        device_class: energy
        icon: mdi:battery-90

      - name: "Consumo Giorno Casa"
        unit_of_measurement: "kWh"
        state: >
          {% set energy = state_attr('sensor.fotovoltaico','current')['energyConsuming'] | float(0) %}
          {{ energy | round(2) }}
        state_class: measurement
        device_class: energy
        icon: mdi:power-socket-it

      - name: "Autoconsum Giorno"
        unit_of_measurement: "kWh"
        state: >
          {% set energy = state_attr('sensor.fotovoltaico','current')['energyAutoconsuming'] | float(0) %}
          {{ energy | round(2) }}
        state_class: measurement
        device_class: energy
        icon: mdi:power-plug-outline

      - name: "Scarica"
        unit_of_measurement: "kWh"
        state: >
          {% set energy = state_attr('sensor.fotovoltaico','current')['energyDischarging'] | float(0) %}
          {{ energy | round(2) }}
        state_class: measurement
        device_class: energy
        icon: mdi:battery-low

      - name: "Carica"
        unit_of_measurement: "kWh"
        state: >
          {% set energy = state_attr('sensor.fotovoltaico','current')['energyCharging'] | float(0) %}
          {{ energy | round(2) }}
        state_class: measurement
        device_class: energy
        icon: mdi:battery-high

      - name: "Produzione"
        unit_of_measurement: "kWh"
        state: >
          {% set energy = state_attr('sensor.fotovoltaico','current')['energyGenerating'] | float(0) %}
          {{ energy | round(2) }}
        state_class: measurement
        device_class: energy
        icon: mdi:solar-power

      - name: "Prelievo"
        unit_of_measurement: "kWh"
        state: >
          {% set energy = state_attr('sensor.fotovoltaico','current')['energyImporting'] | float(0)%}
          {{ energy | round(2) }}
        state_class: measurement
        device_class: energy
        icon: mdi:transmission-tower

      - name: "Immissione"
        unit_of_measurement: "kWh"
        state: >
          {% set energy = state_attr('sensor.fotovoltaico','current')['energyExporting'] | float (0) %}
          {{ energy | round(2) }}
        state_class: measurement
        device_class: energy
        icon: mdi:solar-power

      ##### total
      - name: "Produzione Totale"
        unit_of_measurement: "kWh"
        state: >
          {% set energy = state_attr('sensor.fotovoltaico','total')['energyGenerating'] | float(0) %}
          {{ energy | round(2) }}
        state_class: total_increasing
        device_class: energy
        icon: mdi:weather-sunny

      - name: "Prelievo Totale"
        unit_of_measurement: "kWh"
        state: >
          {% set energy = state_attr('sensor.fotovoltaico','total')['energyImporting'] | float (0) %}
          {{ energy | round(2) }}
        state_class: total_increasing
        device_class: energy
        icon: mdi:transmission-tower

      - name: "Immissione Totale"
        unit_of_measurement: "kWh"
        state: >
          {% set energy = state_attr('sensor.fotovoltaico','total')['energyExporting'] | float(0) %}
          {{ energy | round(2) }}
        state_class: total_increasing
        device_class: energy
        icon: mdi:flash-circle

      - name: "Autoconsum Totale"
        unit_of_measurement: "kWh"
        state: >
          {% set energy = state_attr('sensor.fotovoltaico','total')['energyAutoconsuming'] | float(0) %}
          {{ energy | round(2) }}
        state_class: total_increasing
        device_class: energy
        icon: mdi:power-plug-outline

      - name: "Scarica Totale"
        unit_of_measurement: "kWh"
        state: >
          {% set energy = state_attr('sensor.fotovoltaico','total')['energyDischarging'] | float(0) %}
          {{ energy | round(2) }}
        state_class: total_increasing
        device_class: energy
        icon: mdi:battery-low

      - name: "Carica Totale"
        unit_of_measurement: "kWh"
        state: >
          {% set energy = state_attr('sensor.fotovoltaico','total')['energyCharging'] | float(0) %}
          {{ energy | round(2) }}
        state_class: total_increasing
        device_class: energy
        icon: mdi:battery-high

Mettendo questo:

logger:
  default: error
  logs:
    homeassistant.components.rest: debug
    homeassistant.components.rest.data: debug
    custom_components.zcsazzurro: debug
    custom_components.zcsazzurro.sensor: debug

come hai suggerito sopra in configuration.yaml, se vado in Settings > System > Logs e poi spingo Load Full logs (dimmi se questo è giusto) leggo questo:

2023-01-08 00:16:38.005 DEBUG (MainThread) [custom_components.zcsazzurro.sensor] method: POST
2023-01-08 00:16:38.005 DEBUG (MainThread) [custom_components.zcsazzurro.sensor] _ENDPOINT: https://third.zcsazzurroportal.com:19003
2023-01-08 00:16:38.005 DEBUG (MainThread) [custom_components.zcsazzurro.sensor] auth: None
2023-01-08 00:16:38.005 DEBUG (MainThread) [custom_components.zcsazzurro.sensor] headers: {'Client': '*****', 'Authorization': 'Zcs *********'}
2023-01-08 00:16:38.005 DEBUG (MainThread) [custom_components.zcsazzurro.sensor] payload: {"realtimeData": {"command": "realtimeData", "params": {"thingKey": "**********", "requiredValues": "*"}}}
2023-01-08 00:16:38.005 DEBUG (MainThread) [custom_components.zcsazzurro.sensor] verify_ssl: False
2023-01-08 00:16:38.016 DEBUG (MainThread) [homeassistant.components.rest.data] Updating from https://third.zcsazzurroportal.com:19003
2023-01-08 00:16:43.435 DEBUG (MainThread) [custom_components.zcsazzurro.sensor] Data fetched from resource: {"realtimeData": {"success": true, "params": {"value": [{"***************": {"energyGenerating": "", "energyCharging": "", "energyImporting": "", "energyAutoconsuming": "", "energyDischargingTotal": "", "energyChargingTotal": "", "energyAutoconsumingTotal": "", "powerImporting": "", "energyDischarging": "", "powerCharging": "", "energyConsuming": "", "energyExporting": "", "thingFind": "", "powerConsuming": "", "powerGenerating": "", "energyImportingTotal": "", "energyExportingTotal": "", "powerAutoconsuming": "", "lastUpdate": "", "batteryCycletime": "", "powerDischarging": "", "energyConsumingTotal": "", "batterySoC": "", "energyGeneratingTotal": "", "powerExporting": ""}}]}}}
2023-01-08 00:16:43.435 DEBUG (MainThread) [custom_components.zcsazzurro.sensor] Return the state: True
2023-01-08 00:16:43.435 DEBUG (MainThread) [custom_components.zcsazzurro.sensor] Return the state attributes
2023-01-08 00:16:43.436 DEBUG (MainThread) [custom_components.zcsazzurro.sensor] thingkey: **********
2023-01-08 00:18:43.713 DEBUG (MainThread) [homeassistant.components.rest.data] Updating from https://third.zcsazzurroportal.com:19003
2023-01-08 00:18:44.077 DEBUG (MainThread) [custom_components.zcsazzurro.sensor] Data fetched from resource: {"realtimeData": {"success": true, "params": {"value": [{"**********": {"energyGenerating": "", "energyCharging": "", "energyImporting": "", "energyAutoconsuming": "", "energyDischargingTotal": "", "energyChargingTotal": "", "energyAutoconsumingTotal": "", "powerImporting": "", "energyDischarging": "", "powerCharging": "", "energyConsuming": "", "energyExporting": "", "thingFind": "", "powerConsuming": "", "powerGenerating": "", "energyImportingTotal": "", "energyExportingTotal": "", "powerAutoconsuming": "", "lastUpdate": "", "batteryCycletime": "", "powerDischarging": "", "energyConsumingTotal": "", "batterySoC": "", "energyGeneratingTotal": "", "powerExporting": ""}}]}}}

ho messo gli asterischi dove ci sono i miei dati

sdesalve commented 1 year ago

Funziona tutto come puoi vedere...

Ma le API di zcs restituiscono valori vuoti. Dovresti sentire loro direttamente

Piero87 commented 1 year ago

Gli ho scritto e mi hanno chiesto se ho il connext e gli ho detto di no guardando online non ho quel dispositivo, vediamo cosa mi rispondono

FranFabi commented 1 year ago

@FranFabi io ho lo stesso problema come hai risolto?

Ciao, in pratica solo con il Connext non può funzionare perché non comunica con il server dove sono presenti le API. Mi hanno detto che avrebbero integrato con l anno nuovo. PS io ho solo il Connext senza modulo wi-fi

Piero87 commented 1 year ago

io invece ho il modulo wifi, ma da quello che ho capito il modulo wifi dovrebbe funzionare se non ho capito male

Piero87 commented 1 year ago

anche perchè tra l'altro la loro app ufficiale la uso e i dati li arrivano