Skip to content

Commit

Permalink
Cloud: Use Dashboard v2
Browse files Browse the repository at this point in the history
  • Loading branch information
ledermann committed Jan 11, 2025
1 parent cd2d35d commit c82f8d3
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 62 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ GEM
rubocop-rspec (3.3.0)
rubocop (~> 1.61)
ruby-progressbar (1.13.0)
senec (0.17.2)
senec (0.18.0)
faraday
faraday-net_http_persistent
faraday-request-timer
Expand Down
20 changes: 10 additions & 10 deletions lib/cloud_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,51 +110,51 @@ def record_hash
end

def dashboard_record
@dashboard_record ||= dashboard.data
@dashboard_record ||= dashboard.data(version: 'v2')
end

def technical_data_record
@technical_data_record ||= technical_data.data
end

def measure_time
Time.parse(dashboard_record['zeitstempel']).to_i
Time.parse(dashboard_record['timestamp']).to_i
end

def inverter_power
dashboard_record.dig('aktuell', 'stromerzeugung', 'wert')&.round
dashboard_record.dig('currently', 'powerGenerationInW')&.round
end

def house_power
dashboard_record.dig('aktuell', 'stromverbrauch', 'wert')&.round
dashboard_record.dig('currently', 'powerConsumptionInW')&.round
end

def wallbox_charge_power
dashboard_record.dig('aktuell', 'wallbox', 'wert')&.round
dashboard_record.dig('currently', 'wallboxInW')&.round
end

def ev_connected
dashboard_record['electricVehicleConnected'] == 'true'
end

def grid_power_minus
dashboard_record.dig('aktuell', 'netzeinspeisung', 'wert')&.round
dashboard_record.dig('currently', 'batteryChargeInW')&.round
end

def grid_power_plus
dashboard_record.dig('aktuell', 'netzbezug', 'wert')&.round
dashboard_record.dig('currently', 'gridDrawInW')&.round
end

def bat_power_plus
dashboard_record.dig('aktuell', 'speicherbeladung', 'wert')&.round
dashboard_record.dig('currently', 'batteryChargeInW')&.round
end

def bat_power_minus
dashboard_record.dig('aktuell', 'speicherentnahme', 'wert')&.round
dashboard_record.dig('currently', 'batteryDischargeInW')&.round
end

def bat_fuel_charge
dashboard_record.dig('aktuell', 'speicherfuellstand', 'wert')&.round(1)
dashboard_record.dig('currently', 'batteryLevelInPercent')&.round(1)
end

def bat_charge_current
Expand Down
30 changes: 15 additions & 15 deletions spec/cassettes/senec-cloud-first-system.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c82f8d3

Please sign in to comment.