mf76130
(Mf76130)
November 17, 2022, 4:17pm
108
just add state_class: total_increasing to the template/sensor that has the total kWh
- name: "Solax Solar energy total"
state: "{{ ((state_attr('sensor.solax', 'Data')[81] * 65536) + state_attr('sensor.solax', 'Data')[80]) | float / 10 }}"
unit_of_measurement: "kWh"
device_class: "energy"
state_class: total_increasing
mf76130
(Mf76130)
November 17, 2022, 4:20pm
109
and by the way, i did adapt a local API that works with the actual pocket wifi 2.0
Simple code to get all Data via API direct from you Solax Pocket Wifi 2.0 with firmare 3.003.02.
I found a very interesting post homeassistant-cz , copied the code, reworked it.
Running on
Home Assistant 2022.11.3
Supervisor 2022.10.2
Operating System 9.3
Frontend 20221108.0 - latest
You just need to add code to configuration.yaml, templates.yaml and then add 1 device to the energy dashboard.
add this to configuration.yaml don’t forget to adapt the IP of your solax module amd the password…
waraku
(Waraku)
November 26, 2022, 2:20pm
110
Hello, I need your help. I’m still relatively new to HA. I would like to integrate my Solax WR. I copied the code with my data into the configuration.yaml. There is a green tick on it. When testing the configuration I get the following message “Integration error: sensors - Integration ‘sensors’ not found.” Can someone tell me where the problem is. Many Thanks
There are some great suggestions in this thead that heled my get everything working.
For anyone new, I have created a fully worked example .
2 Likes
sjcsystems
(Simon Clark)
December 24, 2022, 3:53pm
112
First post in the forums…
Couple of things to add…I have an X1-Hybrid inverter, 6kW
The inverter registration number starts S V V - it is not S W
If you log in to the Solax Cloud website, then in the left side menu click Service, then API, it will show your token and also a URL that can be copy/pasted to a browser tab
The URL is somewhat different to that shown at the top of this post.
Now time for my tea, and more playing…
1 Like
Just tried this (link a the end) and it all works.
Cloud sensors can be used on dashboard, but made my own with the local sensors.
LOCAL Access with 5sec Polling (X1-Hybrid-G4 with Pocket WIFI)
Only bit not mentioned is how to get your inverter IP address.
I looked at my attached devices in my router settings device name comes up with
IPv4 Address: 192.168.0.xxx ; Device Name: “espressif”
There is another way which is to connect your laptop wifi directly to pocket wifi access point and logging into inverter via 5.8.8.8 IP address
I am a very happy person right now. Thanks to @kamilb
Having struggled with the default Solax integration , I’ve set myself a challenge of using the available local and cloud APIs instead. The main motivation behind this was to get real-time data from the inverter, particularly the grid in/out readings from the CT clamp so that I can maximise self-use. In addition, being able to charge the battery from the grid in case of low solar forecast would be a nice to have.
The end result looks like this:
[Screenshot at 2022-12-28 13-32-10]
… plus a few …
1 Like
Sniip85
(Sniip85)
January 18, 2023, 5:49pm
114
Hi All,
please could anyone help with error message ?
I inserted code to the conf.yaml , restart HA and in the entities I am able to see it.
But every entity has red exclamation mark with the text:
This entity (‘sensor.solax_soc_level’) does not have a unique ID, therefore its settings cannot be managed from the UI.
Thank you very much Lukas
My Code:
sensor:
- platform: rest
scan_interval: 60
resource: https://www.solaxcloud.com/proxyApp/proxy/api/getRealtimeInfo.do?tokenId=2022XXXXXXXXXXXXXXXXXX&sn=SRXXXXXXXX
name: "Solax Garage"
json_attributes_path: "$.result"
json_attributes:
- yieldtoday
- yieldtotal
- powerdc1
- powerdc2
- uploadTime
- inverterStatus
- acpower
- feedinpower
- feedinenergy
- soc
- consumeenergy
- batPower
value_template: "1" # dummy value; not used; avoids error
- platform: template
sensors:
solax_garage_today:
friendly_name: "Solax Garage today"
value_template: "{{ state_attr('sensor.solax_garage', 'yieldtoday') }}"
unit_of_measurement: "kWh"
solax_garage_total:
friendly_name: "Solax Garage total"
value_template: "{{ state_attr('sensor.solax_garage', 'yieldtotal') }}"
unit_of_measurement: "kWh"
solax_garage_now:
friendly_name: "Solax Garage now"
value_template: "{{ state_attr('sensor.solax_garage', 'acpower') }}"
unit_of_measurement: "W"
solax_garage_pv1:
friendly_name: "Solax Garage PV Power1"
value_template: "{{ state_attr('sensor.solax_garage', 'powerdc1') }}"
solax_garage_pv2:
friendly_name: "Solax Garage PV Power2"
value_template: "{{ state_attr('sensor.solax_garage', 'powerdc2') }}"
unit_of_measurement: "W"
icon_template: mdi:solar-panel
solax_garage_pin:
friendly_name: "Solax Garage FeedIn Power"
value_template: "{{ state_attr('sensor.solax_garage', 'feedinpower') }}"
unit_of_measurement: "W"
solax_garage_ein:
friendly_name: "Solax Garage FeedIn Energy"
value_template: "{{ state_attr('sensor.solax_garage', 'feedinenergy') }}"
unit_of_measurement: "kWh"
solax_garage_soc:
friendly_name: "Solax Garage Battery Charge level"
value_template: "{{ state_attr('sensor.solax_garage', 'soc') }}"
unit_of_measurement: "%"
solax_garage_econ:
friendly_name: "Solax Garage Consume Energy"
value_template: "{{ state_attr('sensor.solax_garage', 'consumeenergy') }}"
unit_of_measurement: "kWh"
solax_garage_upload_time:
friendly_name: "Solax Garage upload time"
value_template: "{{ state_attr('sensor.solax_garage', 'uploadTime') }}"
icon_template: mdi:alarm-check
solax_garage_bat_power:
friendly_name: "Solax Battery Power"
value_template: "{{ state_attr('sensor.solax_garage', 'batPower') }}"
solax_garage_status:
friendly_name: "Solax Garage status"
value_template: >
{% if state_attr('sensor.solax_garage', 'inverterStatus') == '100' %}Wait
{% elif state_attr('sensor.solax_garage', 'inverterStatus') == '101' %}Check
{% elif state_attr('sensor.solax_garage', 'inverterStatus') == '102' %}Normal
{% elif state_attr('sensor.solax_garage', 'inverterStatus') == '103' %}Fault
{% elif state_attr('sensor.solax_garage', 'inverterStatus') == '104' %}Permanent Fault
{% elif state_attr('sensor.solax_garage', 'inverterStatus') == '105' %}Update
{% elif state_attr('sensor.solax_garage', 'inverterStatus') == '106' %}EPS Check
{% elif state_attr('sensor.solax_garage', 'inverterStatus') == '107' %}EPS
{% elif state_attr('sensor.solax_garage', 'inverterStatus') == '108' %}Self-test
{% elif state_attr('sensor.solax_garage', 'inverterStatus') == '109' %}Idle
{% elif state_attr('sensor.solax_garage', 'inverterStatus') == '110' %}Standby
{% elif state_attr('sensor.solax_garage', 'inverterStatus') == '111' %}Pv Wake Up Bat
{% elif state_attr('sensor.solax_garage', 'inverterStatus') == '112' %}Gen Check
{% elif state_attr('sensor.solax_garage', 'inverterStatus') == '113' %}Gen Run
{% else %}I dont know{% endif %}
solax_now:
friendly_name: "Inverter Power"
unit_of_measurement: "W"
value_template: "{{ (states('sensor.solax_garage_now') | float) }}"
icon_template: mdi:lightning-bolt-circle
solax_today:
friendly_name: "PV today"
unit_of_measurement: "kWh"
value_template: "{{ (states('sensor.solax_garage_today') | float) }}"
solax_total:
friendly_name: "PV total"
unit_of_measurement: "kWh"
value_template: "{{ (states('sensor.solax_garage_total') | float) }}"
solax_pv_power1:
friendly_name: "PV Power1"
unit_of_measurement: "W"
value_template: "{{ (states('sensor.solax_garage_pv1') | float) }}"
icon_template: mdi:solar-power-variant-outline
solax_pv_power2:
friendly_name: "PV Power2"
unit_of_measurement: "W"
value_template: "{{ (states('sensor.solax_garage_pv2') | float) }}"
icon_template: mdi:solar-power-variant-outline
solax_pv_power_total:
friendly_name: "PV Power Total"
unit_of_measurement: "W"
value_template: "{{ (states('sensor.solax_garage_pv2') | float) + (states('sensor.solax_garage_pv1') | float) }}"
icon_template: mdi:solar-power-variant
solax_house_cons:
friendly_name: "House Power"
unit_of_measurement: "W"
value_template: "{{ (states('sensor.solax_garage_now') | float) - (states('sensor.solax_garage_pin') | float) }}"
icon_template: mdi:home-lightning-bolt-outline
solax_feedin_power:
friendly_name: "Grid Power"
unit_of_measurement: "W"
icon_template: mdi:transmission-tower
value_template: "{{ (states('sensor.solax_garage_pin') | float) }}"
solax_feedin_energy:
friendly_name: "FeedIn Energy"
unit_of_measurement: "kWh"
value_template: "{{ (states('sensor.solax_garage_ein') | float) }}"
solax_soc_level:
friendly_name: "Battery Charge level"
unit_of_measurement: "%"
value_template: "{{ (states('sensor.solax_garage_soc') | float) }}"
icon_template: mdi:home-battery
solax_batt_power:
friendly_name: "Battery Power"
unit_of_measurement: "W"
value_template: "{{ (states('sensor.solax_garage_bat_power') | float) }}"
icon_template: mdi:battery
solax_consume_energy:
friendly_name: "Consume Energy"
unit_of_measurement: "kWh"
value_template: "{{ (states('sensor.solax_garage_econ') | float) }}"
solax_consume_power:
friendly_name: "Consume Power"
unit_of_measurement: "W"
value_template: "{{ (states('sensor.solax_garage_now') | float) - (states('sensor.solax_garage_pin') | float) }}"
# Calculate battery power in and out
battery_in:
friendly_name: Battery in
unit_of_measurement: W
value_template: >
{% if (states('sensor.solax_garage_bat_power') | float ) > 0 %}
{{ (states('sensor.solax_garage_bat_power') | float | abs) }}
{% else %}
0
{% endif %}
battery_out:
friendly_name: Battery out
unit_of_measurement: W
value_template: >
{% if (states('sensor.solax_garage_bat_power') | float ) < 0 %}
{{ (states('sensor.solax_garage_bat_power') | float | abs) }}
{% else %}
0
{% endif %}
- platform: integration
source: sensor.battery_in
name: total_battery_in
unit_prefix: k
round: 2
method: left
- platform: integration
source: sensor.battery_out
name: total_battery_out
unit_prefix: k
round: 2
method: left
- platform: integration
source: sensor.solax_house_cons
name: selfiehome_energy_spent
unit_prefix: k
round: 2
template:
- sensor:
- name: test_energy
state: "{{ states('sensor.solax_total') }}"
unit_of_measurement: 'kWh'
state_class: measurement
device_class: energy
attributes:
last_reset: '1970-01-01T00:00:00+00:00'
# Solax
Very good point! I was using the serial number of the inverter for weeks and got nothing! Its the REGISTRATION number that was needed NOT the serial number!
Thank you!
1 Like
YarniP
February 10, 2023, 11:23am
118
Did you get any response?
YarniP
February 12, 2023, 11:53pm
119
I added this to my energy dashboard but I get a message ‘Self-consumed solar energy couldn’t be calculated’ the stored value of the sensor is 54 kWh. do you know whats wrong?
Doublet
February 15, 2023, 8:28am
120
I am now using a 100% local solution, no need to use the solaxcloud: Solax X1 Boost Air Mini : local data
Tinusw
(Martijn)
March 1, 2023, 10:52am
121
In what yaml file do you place this code?
I have a sensor.yaml file but I don’t know where to fit this in
And if I paste it in configuration.yaml, it says the code is okay, but lets check if I am doing things in the right way
*EDIT: I placed the sensors in configuration.yaml, better would be to fit this in a custom.yaml or something, but I didn’t get it done so putted it in configuration.yaml and it works as it should be now!
Tinusw
(Martijn)
March 1, 2023, 12:44pm
122
Testing your code right now. I didn’t get any error messages. Solax X3 here. I only wonder if the state_class: measurement is right in stead of total_increase.
We will see!
*EDIT It works for me with this code, sensorname yieldtotal could have an other name in your own api/setup but you have to choose the total yield, not day total.:
template:
- sensor:
- name: PV opbrengst (Total)
state: "{{ states('sensor.solax_api_yieldtotal') | float }}"
availability: "{{ states('sensor.solax_api_yieldtotal') | float > 0 }}"
unit_of_measurement: "kWh"
state_class: total_increasing
device_class: energy
attributes:
last_reset: "1970-01-01T00:00:00+00:00"
fxstein
(Oliver)
March 5, 2023, 8:31pm
123
Has anyone else gotten an API error in the past three days? It looks like the Solax Cloud API has been down since Friday.
Kars
(Kars de Jong)
March 5, 2023, 10:03pm
124
Yes, same here. The server responds with an exception:
The server is busy. Please try again later!
1 Like
fxstein
(Oliver)
March 5, 2023, 10:32pm
125
Thanks for confirming.
Very flaky API. Definitely not to be recommended. Put uptime graphs on it about 24 days ago:
u1315
(U1315)
March 9, 2023, 4:37pm
126
It seems API access is open for 10 minutes every hour.
Kars
(Kars de Jong)
March 9, 2023, 10:23pm
127
It’s been OK for me since March 7 00:58 UTC.
pilot173
(Pilot173)
March 14, 2023, 7:14pm
128
Hello,
Somebody has a problem with API?
Today, I can’t get information from the API cloud, only for every 1 hour.
Everything was working fine until yesterday.
When I paste the API link to the browser, I got this:
{“exception”:“The overrun has been disabled for 1 hour!”,“success”:false}
Can you confirm that there is a problem on Solax cloud or on my side?