Giter VIP home page Giter VIP logo

homebridge-solax's Introduction

Homebridge-Solax Platform Plugin

Use this plugin to monitor your Solax Inverter. It can provide realtime metrics from your inverter along with configurable alerts for Automation purposes.

Note: HomeKit doesn't natively support a solar inverter or a watts based acccessory. To work around this limitation, a light sensor accessory is used the display the various metrics. Noting the minimum allowed value for a light sensor is 0.1.

Example Homekit Page

Requires the installation of the Solax Monitoring Dongle, and usage of a static IP address on your LAN. Refer to your Router configuration guide on how to do this.

Once you know the IP address of your Solax Inverter, navigate to http://{InverterIpAddress}/api/realTimeData.htm Here you should get a (malformed) JSON payload, but this will confirm it's possible to extract metrics from it.

Installation

Install Plugin

npm install homebridge-solax

Configure

    "platforms": [
      {
        "platform" : "SolaxHomebridgePlugin",
        "name" : "Solax Inverter",
        "address": "http://192.168.1.40",
        "pollingFrequencySeconds": 60,
        "movingAverageHistoryLength": 10,
        "exportAlertThresholds": [-5000, 0, 1000, 1500],
        "showStrings": true,
        "hasBattery": false,
        "valueStrategy": "SimpleMovingAverage"
      }
    ]

address: The base hostname of your inverter connection dongle

pollingFrequencySeconds: Optional: Specifies how often to poll the Solax Inverter, and issue updates to HomeKit. Defaults to 60 seconds.

movingAverageHistoryLength: Optional: Specifies the number of samples to keep when using Averaging over time based value strategies. Defaults to 10 entries. See valueStrategy field for details on how this is used.

exportAlertThresholds: Optional: Array of integers specifying the thresholds to create Alerts for. This will activate a motion trigger when the power export matches or exceeds the threshold value. Example: [-1000, 500, 2000] will create three motion sensors - "1000 watts imported", "500 watts exported" and "2000 watts exported".

showStrings: Optional: Defaults to true. Shows Individual Inverter String metrics (PV1, PV2).

hasBattery: Optional: Defaults to true. Experimental. Shows Battery information. Note, due to limited documentaiton from Solax, the Charging State is estimated based on the delta of Battery Watts.

valueStrategy: Optional: Defaults to SimpleMovingAverage. LatestReading = use the latest values at each polling period, SimpleMovingAverage for providing some smoothing of values, to handle scenarios like sporadic cloud/sun moments. Averages over the entire history. ExponentialMovingAverage = Use standard Exponential Moving Average calculation to provide a smoothed last value. Refer to movingAverageHistoryLength for Moving Average based history tuning.

exposeRawMetrics: Optional: Defaults to true. 3 additional accessories will be exposed to provide the raw value feed (no averaging based filtering).

Leveraging in Automations via Motion Sensor Accessories

You can then create Automations in HomeKit as a result of the motion detection events (or them ceasing to happen). Example: If 2000 watts or more is being exported, and heatpump isn't already cranked, then bump the temperature up. I personally use Home+, as it allows for smarter controlling of devices. E.g. See below Solar Excess Automation Solar Insufficient Automation

homebridge-solax's People

Contributors

dependabot[bot] avatar troygnz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

o0shojo0o

homebridge-solax's Issues

FetchError: network timeout

Describe the bug
Ever since installing Home Assistant (with the SolaX plugin) my HomeBridge log is full of the following error:

[28/02/2022, 22:39:22] [Solax Inverter] That did not go well. Error: FetchError: network timeout at: http://192.168.2.114/api/realTimeData.htm
[28/02/2022, 22:39:22] [Solax Inverter] Failed to read from Solax. Error: FetchError: network timeout at: http://192.168.2.114/api/realTimeData.htm

This repeats around a couple of times per minute. However, despite the error, the data in HK does update and displays seemingly correct values.

Expected behavior
I’m guessing there’s some kind of clash between HomeAssistant and HomeBridge requesting data from the inverter, however it does work sufficiently to keep the data reasonably up to date. Would it be possible to calm down the logs? My HB log is full of these errors, which feels a little much.

Thanks!

Ability to change battery use times in inverter settings

Is your feature request related to a problem? Please describe.
I’m guessing this won’t be possible, as I haven’t seen any APIs anywhere that can push new settings to the inverter, but thought I’d ask!
I have my DC battery set to discharge only during certain times. At night when I charge my EVs, the battery is set to not discharge, as I don’t want to charge the EVs from the house battery. I can change the settings using the SolaX app (after entering a four digit PIN).
It would be nice to be able to dynamically change the times the battery discharges through the Home app. Even a “Dicharge / Not discharge” button that merely changes the discharge times on the inverter would be awesome.

Have you seen anything that would allow for this?

Dynamic polling

Based on time, adjust the frequency of polling. Once the sun is down, it's pointless polling until the next morning

Battery state not working with SolaX hybrid inverter

Describe the bug
Not sure if a bug or an improvement / supporting more devices.

My inverter provides all the values for the battery in the data string. As follows:

"method":"uploadsn","version":"Solax_SI_CH_2nd_20160912_DE02","type":"AL_SE","SN":"serialnumber","Data":[6.1,6.4,212.0,178.9,0.9,245.6,97,37,2.2,8319.2,-48,1293,1144,54.78,41.19,2259,26,67,0.0,2823.5,,,,,,,,,,,,,,,,,,,,,,0.00,0.00,,,,,,,,50.03,,,0.0,0.0,0,0.00,0,0,0,0.00,0,9,0,0,0.00,0,9],"Status":"2"}

The “67” value above is the current battery %.
The “2259” figure is the current watts going into the battery.

At the moment, the plugin shows 0% for my battery (says not supported in the Home app, but I get 0% on others).

To Reproduce
N/A

Expected behavior
The battery accessory to show the battery % from the above string, maybe a further accessory to show the battery input/output.

Screenshots
N/A

Desktop (please complete the following information):
N/A

Smartphone (please complete the following information):
N/A

Additional context

Thanks for your work!

Only absolute URLs are supported

Hi Would like to start by saying that I'm new to Homebridge and have had some success with using it.

I really like the fact that there is a Solax plugin, as this will be a fantastic feature that i can add to my home setup.

i have installed the plugin, however I'm not seeing any updates and when i referred to the status log i can see an error message with the following :

"only absolute URL's are supported"

Screenshots
[10/01/2022, 8:59:02 am] [Solax Inverter] That did not go well. Error: TypeError: Only absolute URLs are supported
[10/01/2022, 8:59:02 am] [Solax Inverter] Failed to read from Solax. Error: TypeError: Only absolute URLs are supported

The current environment config is running

Node.js Version | v16.13.1
NPM | v8.1.2

I have tested the url http://192.168.xxx.xxx/api/realTimeData.htm to confirm that the content is available. See below: (Note, i just removed the SN data)

{"method":"uploadsn","version":"Solax_SI_CH_2nd_20160912_DE02","type":"AL_SE","SN":"(I have removed)","Data":[0.8,0.8,379.1,193.3,-0.9,233.5,0,43,0.9,20314.2,-4939,303,154,49.86,9.26,462,26,16,0.1,3943.1,,,,,,,,,,,,,,,,,,,,,,0.00,0.00,,,,,,,,50.00,,,0.0,0.0,0,0.00,0,0,0,0.00,0,9,0,0,0.00,0,9],"Status":"2"}

if there is anything else that may help support the review of this issue, please let me know.

Cheers

Vinny

Verbose mode

Is your feature request related to a problem? Please describe.
I like the values given to be reasonably up to date, with a little averaging to deal with wild fluctuations. I’ve currently set the polling time to 10s. The issue is the HB log has the polling strings shown every 10s, which is filling up the log quite considerably!

Describe the solution you'd like
A verbose option to enable or disable the regular polling strings. With verbose logging on, this will show, with verbose off, only the get strings will show.

Describe alternatives you've considered
Putting up with it!

Additional context
N/A

Thanks!

Failed to read from Solax. Error: Error: Authorization Required

Hello!
I am trying to use your plugin but there is a problem with the connexion between the Solax Monitoring Dongle and the plugin.
I am getting the same error all the time
image

To Reproduce
Steps to reproduce the behavior:

  1. Install the plugin
  2. Set up the plugin
  3. Getting the error on Homebridge's console

Desktop (please complete the following information):

  • OS: WIndows
  • Browser chrome
  • Version 1.3.2

Crashing Homebridge on default new install

Default install on the latest docker image I get this as soon as I restart Homebridge:

[1/6/2022, 11:37:58 AM] TypeError: Cannot read properties of undefined (reading 'join')
at Function.logDetails (/homebridge/node_modules/homebridge-solax/src/config.ts:25:72)
at new SolaxPlatform (/homebridge/node_modules/homebridge-solax/src/solaxPlatform.ts:24:18)
at /usr/local/lib/node_modules/homebridge/src/server.ts:440:40
at Array.forEach ()
at Server.loadPlatforms (/usr/local/lib/node_modules/homebridge/src/server.ts:372:27)
at Server.start (/usr/local/lib/node_modules/homebridge/src/server.ts:159:29)
[1/6/2022, 11:37:58 AM] Got SIGTERM, shutting down Homebridge...

Hostname vs IP Address

I'm using the local LAN IP of the inverter in the address field (same as your example code) but it seems to want a URL hostname?

[1/6/2022, 2:06:49 PM] [Solax Inverter] That did not go well. Error: TypeError: Only absolute URLs are supported
[1/6/2022, 2:06:49 PM] [Solax Inverter] Failed to read from Solax. Error: TypeError: Only absolute URLs are supported
[1/6/2022, 2:06:54 PM] [Solax Inverter] That did not go well. Error: TypeError: Only absolute URLs are supported
[1/6/2022, 2:06:54 PM] [Solax Inverter] Failed to read from Solax. Error: TypeError: Only absolute URLs are supported

Example Code:

"platforms": [
{
"platform" : "SolaxHomebridgePlugin",
"name" : "Solax Inverter",
"address": "http://192.168.1.40",
"pollingFrequencySeconds": 60,
"movingAverageHistoryLength": 10,
"exportAlertThresholds": [-5000, 0, 1000, 1500],
"showStrings": true,
"hasBattery": false,
"valueStrategy": "SimpleMovingAverage"
}
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.