Skip to content

AllMightySauron/homebride-solaxcloud-api

Repository files navigation

Solax Cloud Plugin for Homebridge

npm npm verified-by-homebridge

The Solax Cloud Plugin for Homebridge was created as a platform plugin to gather data exposed by Solax inverters to the cloud through the Solax Cloud API. Please note that QCells inverters are also supported since cloud requests share a similar approach.

Now with support for multiple inverters! Sensors will be created for each of the inverters present in the configuration. Additionally, a virtual inverter named "All inverters" will be created whenever a multiple inverters configuration is present. This inverter will present summarized power and consumption figures derived from data for all the physical inverters.

As HomeKit is still clueless about what a solar panel is, this plugin exposes a set of standard HomeKit accessories though Homebridge for each configured inverter that will allow interacting and automating your smart home based on the data made available from the Solax platform:

  • PV (PV outlet with power consumption)
  • AC (Inverter AC outlet with power and total energy consumptions)
  • To Grid (Inverter to Grid outlet with power consumption)
  • To House (Inverter to House outlet with power consumption)
  • From Grid (Grid to House outlet with power consumption)
  • Update (Motion sensor)

Battery information is also provided as Homekit accessories in case there are any batteries installed for any of the configured inverters:

  • To Battery (Outlet with inverter power charging the battery)
  • From Battery (Outlet with power drawn from the battery to the inverter)
  • Battery (Battery with State of Charge information such as level or charge state)

Please note that additional accessories are created by default with smooth power consumption curves (by applying either a simple or exponential moving average to the power series). This prevents sporadic events like a cloud passing by to have an immediate affect on provided meters.

Required information

For this plugin to work, two critical pieces of information are required from Solax/QCells Cloud:

  • Token ID: Solax/Qcells users can get inverter information through the granted tokenID. You need to obtain your tokenID on the API page of Solax/Qcells cloud.
  • SN: Registration No (communication module SN) for each desired inverter.

Installation

This plugin is supported under Homebridge. It is highly recommended that you use Homebridge Config UI X to install and configure this plugin.

Manual Installation

Install this plugin using: sudo npm install -g homebridge-solaxcloud-api. Edit config.json manually to add your Solax inverters. See below for instructions on that.

Platform configuration

Minimal platform configuration is depicted by the example configuration file below:

{
  "platforms": [
    {
      "platform": "SolaxCloudAPI",
      "inverters": [
        {
          "brand": "solax",
          "tokenId": "20200722185111234567890",
          "name": "Solax",
          "sn": "ABCDEFGHIJ"
        }
      ],
    }
  ]
}

Configuration parameters are described on the table below:

Parameter Type Description Default Mandatory?
platform string Platform name (must be SolaxCloudAPI) - Y
inverters array Array of configured inverters as objects with { brand: string, tokenId: string, name: string, sn: string, hasBattery: boolean }, where brand is "solax" or "qcells", tokenID is the access token retrieved from the API page of Solax/QCells Cloud, name is the inverter name, used as prefix for accessory naming, sn is the inverter registration no. (inverter module SN) and hasBattery indicates on whether this inverter is connected to a battery. - Y
pollingFrequency number Plugin data polling frequency from Solax Cloud (in seconds) 300 N
smoothingMeters boolean Whether to create additional meters by smoothing raw values from Solax Cloud true N
smoothingMethod string Statistical method to use for smoothing raw values from Solax Cloud (simple or exponential moving average - "sma" or "ema") "sma" N
pureHomeApp boolean Whether to create meters as standard accessories that can be used on the Home App (power will show as ambient light sensors) false N

NOTE: The pollingFrequency parameter defaults to 300 seconds, since Solax/QCells inverters update cloud data every 5 minutes.

Configuration through the the use of Homebridge UI plugin is also available and recommended:

Non-standard characteristics

Non-standard accessory characteristics are available through the use of Eve for HomeKit app you may download from the App Store.

This will allow some non-standard characteristics to be visible along with its historical data (like power or total energy consumption), as depicted in the image below:

If you want to rely solely on the native Home App, please enable the pureHomeApp config setting. In this case, power consumption on each meter will be exposed as an Ambient Light Sensor, as shown below (minimum value for an Ambient Light Sensor is 0.1 lux):

Automation

Automation can be achieved with the help of the virtual Update motion sensor that was specifically tailored for this effect and which is available for each inverter. This motion sensor will be triggered whenever inverter data gets updated from the Solax Cloud API (according to what is defined on the pollingFrequency configuration setting).

Motion is detected by the Update motion sensor whenever there is newly fetched inverter data from Solax Cloud. Using this sensor as a trigger combined with power and energy data from the virtual outlets enumerated above forms the basic building blocks for defining an automation.

Automation example

Since automations are probably going to be dependent on the non-standard Consumption characteristics from the virtual outlets, these must created by using the Eve App.

As an automation example, let's imagine we want to turn a pool heater pump on whenever the inverter AC power is greater than a specific figure (in Watt):

1. Under Automation, select Rules 2. Click Next
3. Click Add Trigger 4. Select Motion as trigger type
5. Select the Solax Update motion detector and set Motion as trigger 6. Click Next
7. Select Add Value Condition 8. Choose Inverter AC Consumption as characteristic and elect >= a desired value
9. Click Next 10. If no scene exists, click Add Scene
11. Click Add Actions 12. Select the accessory to be controlled (in this case Garden Pool Outlet will be turned ON)
13. Click Next 14. Name your scene and click Done
15. Click Next 16. Name your rule and click Done

TO DO

Next planned plugin releases should include:

  • Inverter AC to include Total Yield Energy
  • Consumption history through the fakegato-history module
  • Enable support for "pure" Home App accessories (power meters will be exposed as Ambient Light sensors)
  • Add "smooth" accessories for power meters (compensating for sporadic scenarios like cloud a passing)
  • Support for multiple inverters
  • Support for multiple brands (between Solax and QCells)
  • Accessories for battery state and consumptions