Custom Solar Energy Solution for SMA WebConnect Inverters

Ok, that is starting to make sense. I can get a result set back when I do this using Explore:

Before it would take the syntax, I had to switch from InfluxQL to Flux in the upper left corner above.

When I switch over to Grafana and try the same query there, I get nothing:

The issue appears to be that Grafana is in InfluxQL mode and I need to switch it to Flux mode, but I don’t see where I do that.

EDIT: I found it, but it pretty much requires me to convert over to use Flux only. There is no dual mode. I’ll probably wait until the weekend and then make the switch. Fortunately I don’t have that many Grafana dashboard that will break since I just started down this road a few days ago. :slight_smile:

Or set up a parallel data source in Grafana that is identical to your current one but uses Flux?

My Grafana dashboards can switch between data sources that are different Raspberry Pi4 servers but share a common bucket name so the queries work. I use one for production but the other for testing stuff out without screwing up my production database.

Apologies in advance for posting this here, but I figured others might run into the same issue when attempting to convert from InfluxQL to Flux.

My current InfluxDB is setup very standard as follows:

With a basic homeassistant database:

I can query it fine:

Grafana is configured using the basic InfluxDB as shown above:

But when I go to data sources and change the Query Language from InfluxQL to Flux, enter a token and specify a default bucket name, I get an “Error reading InFluxDB”:

Flip back to InfluxQL for the query Language, and the data source is working again.

I must be missing some simple step somewhere…

On the Flux data source you don’t have an Organization defined.

Also I don’t use the Auth settings, both switches are off in my configuration but didn’t see to make a difference even without login details.

I should have mentioned I did try with both the “Basic auth” and “With Credentials” disabled and I still got the “Error reading InfluxDB” message.

Just tried with specifying an Organization, and it didn’t make a difference either.

Flipping back to InfluxDB got rid of the error once I re-enabled “Basic auth” and “With Credentials”.

Rick, are you using the default HTTP config like what I’m showing in my screenshots?

My new test configuration, also no default bucket. I am running InfluxDB 2.1, I suspect you are back at 1.8?

I’m actually on InfluxDB 4.5:

Maybe that’s the issue?

EDIT: Never mind, InfluxDB is 4.5.0 but the actual database appears to be 1.8.5 in that release. I guess I need to do a manual update to get up to 2.1?

HA add on version is 4.5, so your InfluxDB is running with HA while mine is a standalone server.

Looking at the HA add on docs for InfliuxDB I think you must use the Auth options. But your Flux setup references a default database ‘argon’, maybe make that ‘homeassistant’ to match the working data source?

Yeah, I tried with the Auth options (Basic Auth with credentials) and also tried with argon and well as homeassistant for the database/bucket name.

My HA hardware is actually a SuperMicro 1U server chassis with 4 hot swap bays. I got a 2nd such chassis not currently being used for anything. I’m thinking of setting that up as a 2nd HA instance and see if I can get Flux 2.1/2.3 going on it from the get go before.

OR, maybe keep my current HA box the way it is, and then setup a dedicated FluxDB on the other 1U server?

I use Docker on my Raspberry Pi so once you have it installed creating standalone Grafana and InfluxDB instances is a simple docker-compose.yaml file.

I had a chance to dig into this a bit more. I installed Portainer on my HASS box and was able to then browse the docker containers. As far as I can tell, when you add a HA add-on, it creates another container. These are the ones I have installed:

So I pulled the latest and greatest Influxdb2 image and loaded it:

But now I’m lost. All my sensors currently dump to the add-in influxdb plugin. Do I now want to setup paths/volumes to start sending to the new version? Do I want to attempt to migrate all my existing data from the 1.8 container to the 2.3 one? Am I going to break a bunch of stuff?

You mention standalone Grafana and InfluxDB instances via a simple docker-compose.yaml file. How does that work and how it that different from using Portainer to create a docker image of influxdb?

I would stick with what you have since it works and just figure out why the Flux database connection from Grafana doesn’t work and keep your data intact for now. But you mentioned you are an SQL guy I would think you can do the queries in FluxQL and save a lot of headaches. I came to this late in the game and choose the Flux query language but the InfluxDB crew seems to mirror the capabilities in both query languages so should be easy to use the on you prefer.

I am currently on InfluxDB 2.3 and have simple scripts to backup (semi-regular) and restore (when I move to new hardware) the database store. I would guess they have a way of migrating from 1.x to 2.x but never really had to do that.

My servers are all Raspberry Pi 4Bs running Ubuntu 20.04 (but currently migrating to 22.04). So I install Docker and then InfluxDB is a simple Docker Compose YAML file. I also have my solar production (multisma2) and home consumption (cs_esphome) apps running in containers and these are what feed the data to InfluxDB. My production also broadcasts using MQTT for HA to pickup and consumption uses ESPHome to pull that data into HA. I don’t use HA to write any database entries so I am not a good person to answer the questions on that subject.

Since you can write a working FluxQL query in Grafana why translate one of mine and if you need help try the InfluxDB community forum, they seem to be quite good in answering questions.

Could you explain how you weaponize the docker environment? a docker within influxdb, another with grafana and another with multisma2? in influxdb as weapons the scheme of the DB? or does he arm it alone?

I don’t weaponize anything, just two Raspberry Pi 4B’s, one is dedicated to Home Assistant (‘HomeAssistant’) and the other runs Ubuntu Server with Docker installed (‘Docker’).

The HomeAssistant machine is self-contained and only receives data for solar production (via MQTT) and home consumption (via ESPHome) and has some simple dashboards for the display of this data.

The Docker machine runs five Docker containers:

  • portainer
  • mosquitto
  • influxdb2
  • multisma2 (real-time solar data collection from SMA Sunnyboy inverters)
  • cs_esphome (real-time home energy consumption from Circuit Setup 6-channel energy meter)

The first three containers are from Docker Hub, the last two are my custom Python Docker applications, ‘multisma2’ tracking solar production and ‘cs_esphome’ for home energy consumption.

‘multisma2’ aggregates real-time solar production and writes it to an InflxuDB bucket and optionally broadcasts it via MQTT where HomeAssistant picks it up. The Circuit Setup energy meter runs ESPHome so both HomeAssistant and ‘cs_esphome’ pull energy use via that interface.

That is it, if you have some specific questions I hope I can answer them.