jasonacox / Powerwall-Dashboard

Grafana Monitoring Dashboard for Tesla Solar and Powerwall Systems
MIT License
268 stars 57 forks source link

Influxdb2 and measurements #170

Open dakky opened 1 year ago

dakky commented 1 year ago

Hello

I need to use a pre existing influxdb2. In Telegraf I configured a new output in telegraf.local and removed the old influxv1 one from telegraf.conf:

[[outputs.influxdb_v2]]
  urls = ["http://influxdb:8086"]
  token = "XXXXXXX"
  organization = "myorg"
  bucket = "powerwall"

that seems to work fine, telegraf logs no error and i get data in my bucket. In order to use the grafana dashboards without rewriting everything to flux and use influxQL I reconfigured my influxv2 to also accept influxQL queries (which basically means to map a virtual database to a bucket and add a user and password with read access to this database). Then I added a influx v1 datasource to grafana. The test of the datasource itself was successful.

Everthing fine until now. And now the Issue: none of the graphs is working. When looking in a simpler panel there is the following statement:

SELECT integral("home")  / 1000 / 3600 FROM "autogen"."http" WHERE time >= now() - 5m and time <= now() tz('Europe/Berlin')

I do not have a measurement called home in my bucket. I have something like load_instant_power, which is the exact name of the field from pypowerwall, caught by telegraf and written to influx. Where does this home come from? Or that from pv and so on?

List of fields in my http-measurement ``` FWUpdateSucceeded GridCodesWrite ISLAND_FreqL1_Load ISLAND_FreqL1_Main ISLAND_FreqL2_Load ISLAND_FreqL2_Main ISLAND_FreqL3_Load ISLAND_FreqL3_Main ISLAND_L1L2PhaseDelta ISLAND_L1L3PhaseDelta ISLAND_L2L3PhaseDelta ISLAND_PhaseL1_Main_Load ISLAND_PhaseL2_Main_Load ISLAND_PhaseL3_Main_Load ISLAND_VL1N_Load ISLAND_VL1N_Main ISLAND_VL2N_Load ISLAND_VL2N_Main ISLAND_VL3N_Load ISLAND_VL3N_Main METER_X_CTA_I METER_X_CTA_InstReactivePower METER_X_CTA_InstRealPower METER_X_CTB_I METER_X_CTB_InstReactivePower METER_X_CTB_InstRealPower METER_X_CTC_I METER_X_CTC_InstReactivePower METER_X_CTC_InstRealPower METER_X_LifetimeEnergyExport METER_X_LifetimeEnergyImport METER_X_VL1N METER_X_VL2N METER_X_VL3N METER_Y_CTA_I METER_Y_CTA_InstReactivePower METER_Y_CTA_InstRealPower METER_Y_CTB_I METER_Y_CTB_InstReactivePower METER_Y_CTB_InstRealPower METER_Y_CTC_I METER_Y_CTC_InstReactivePower METER_Y_CTC_InstRealPower METER_Y_LifetimeEnergyExport METER_Y_LifetimeEnergyImport METER_Y_VL1N METER_Y_VL2N METER_Y_VL3N PINV_a067_overvoltageNeutralChassis PW1_PINV_Fout PW1_PINV_VSplit1 PW1_PINV_VSplit2 PW1_POD_ActiveHeating PW1_POD_ChargeComplete PW1_POD_ChargeRequest PW1_POD_DischargeComplete PW1_POD_PermanentlyFaulted PW1_POD_PersistentlyFaulted PW1_POD_available_charge_power PW1_POD_available_dischg_power PW1_POD_enable_line PW1_POD_nom_energy_remaining PW1_POD_nom_energy_to_be_charged PW1_POD_nom_full_pack_energy PW1_temp PodCommissionTime SYNC_a001_SW_App_Boot SelfConsumptionReservedLimit SolarChargeOnlyLimited SystemConnectedToGrid backup_reserve_percent battery_energy_exported battery_energy_imported battery_frequency battery_i_a_current battery_i_b_current battery_i_c_current battery_instant_apparent_power battery_instant_average_current battery_instant_average_voltage battery_instant_power battery_instant_reactive_power battery_instant_total_current battery_num_meters_aggregated battery_timeout grid_status load_energy_exported load_energy_imported load_frequency load_i_a_current load_i_b_current load_i_c_current load_instant_apparent_power load_instant_average_current load_instant_average_voltage load_instant_power load_instant_reactive_power load_instant_total_current load_timeout percentage site_energy_exported site_energy_imported site_frequency site_i_a_current site_i_b_current site_i_c_current site_instant_apparent_power site_instant_average_current site_instant_average_voltage site_instant_power site_instant_reactive_power site_instant_total_current site_num_meters_aggregated site_timeout solar_energy_exported solar_energy_imported solar_frequency solar_i_a_current solar_i_b_current solar_i_c_current solar_instant_apparent_power solar_instant_average_current solar_instant_average_voltage solar_instant_power solar_instant_reactive_power solar_instant_total_current solar_num_meters_aggregated solar_timeout ```

Edit: List of fields appended

BJReplay commented 1 year ago

Did you run influxdb/influxdb.sql to create the CQs?

That's where home and the other measurements used by the graphs are created.

You may need to tweak for your setup.

jasonacox commented 1 year ago

Hi @dakky - thanks for raising the issue. I suspect there are others that will want to use an existing InfluxDB v2 installation instead of the project default v1.8.

@BJReplay is correct, the measurements you are looking for are created by the continuous queries (CQs) that are set up as show here: https://github.com/jasonacox/Powerwall-Dashboard/blob/main/influxdb/influxdb.sql

I believe InfluxDB 2.x uses tasks instead of CQs, but perhaps you can figure out a way to make them work. They are in influxQL. Please let us know what you discover.

nberardi commented 1 year ago

InfluxQL only works against InfluxDB1.x. You need to use Flux against InfluxDB2.x+. I have a working solution in my branch that I am readying, however it is a breaking change against the current approach.

https://github.com/nberardi/Powerwall-Dashboard/commit/d0da1cc61039b007e39ba5e14783dd97117f91b5

jasonacox commented 1 year ago

Thanks for sharing that @nberardi . Converting to InfluxDB2 is on the roadmap but non-trival for data migration.

nberardi commented 1 year ago

I was lucky I started from scratch in my case. The data migration is pretty straightforward. The part that made it tricky was the queries and getting them structured in a way that made sense for all the Grafana dashboard graphs. Sent from my iPhone, expect autocorrection issuesOn Feb 28, 2023, at 1:46 AM, Jason Cox @.***> wrote: Thanks for sharing that @nberardi . Converting to InfluxDB2 is on the roadmap but non-trival for data migration.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

dakky commented 6 months ago

when implementing this feature: please have in mind users, which are not running the setup.sh but installed this manually ^^

nberardi commented 6 months ago

@dakky i am not sure what the difference would be, can you share?

dakky commented 6 months ago

@nberardi The difference is, that setup.sh hides what happens inside. So I'm hoping for a manual guide, how to switch from influx1 to influx2. In my case i have copied much of the compose files into an existing setup, because i already have a grafana & influx running.