All, sorry to hear all the issues. Like my previous response, https://github.com/lechk82/solarman-mqtt is working like a charm for a couple of months already:
- no issues with expiring tokens
- no issues with timings
it just works flawlessly!
In short:
- Follow the link above
I’m using the docker-compose method. If you do as well, make sure the config.jason file is located at the correct location. Use the logging to see the output. It should be something similar like:
oh btw, if the DeviceState = 1, the sun is shining , DeviceState = 3: Inverter is offline
- The config.jason formatting is not that well documented, please use the following:
{
"name": "Trannergy",
"url": "api.solarmanpv.com",
"appid": "<id>",
"secret": "<secret>",
"username": "<username>",
"passhash": "<hased password>",
"stationId": <stationid>,
"inverterId": "<inverterid>",
"loggerId": "<loggerid>",
"debug" : false,
"mqtt":{
"broker": "<broker ip>",
"port": 1883,
"topic": "solarmanpv",
"username": "<broker username>",
"password": "<broker password>"
}
}
- Install, if you havent already, a MQTT broker like: MQTT - Home Assistant
- Do use something like MQTT-Explorer to see if the messages are coming in like:
- Add the following in your configuration.yaml:
mqtt:
sensor:
- state_topic: "solarmanpv/station/generationPower"
name: "solarmanpv_station_generationPower"
unique_id: "generatedPower"
unit_of_measurement: "Wh"
device_class: energy
state_class: measurement
- state_topic: "solarmanpv/inverter/deviceState"
name: "solarmanpv_inverter"
unique_id: "solarmanpv_inverter"
json_attributes_topic: "solarmanpv/inverter/attributes"
- state_topic: "solarmanpv/logger/deviceState"
name: "solarmanpv_logger"
unique_id: "solarmanpv_logger"
json_attributes_topic: "solarmanpv/logger/attributes"
sensor:
- platform: template
sensors:
solarmanpv_inverter_device_state:
unique_id: "inverter_device_state"
value_template: >-
{% set mapper = {
'1' : 'Online',
'2' : 'Failure',
'3' : 'Offline'} %}
{% set state = states.sensor.solarmanpv_inverter.state %}
{{ mapper[state] if state in mapper else 'Unknown' }}
- platform: template
sensors:
solarmanpv_logger_device_state:
unique_id: "logger_device_state"
value_template: >-
{% set mapper = {
'1' : 'Online',
'2' : 'Failure',
'3' : 'Offline'} %}
{% set state = states.sensor.solarmanpv_logger.state %}
{{ mapper[state] if state in mapper else 'Unknown' }}
template:
- sensor:
- name: "Solarman energy daily"
unique_id: "solarman_energy_daily"
unit_of_measurement: 'kWh'
state: "{{ state_attr('sensor.solarmanpv_inverter', 'Daily_Production_(Active)') }}"
device_class: energy
state_class: total_increasing
attributes:
last_reset: '1970-01-01T00:00:00+00:00'
- sensor:
- name: solarmanpv_inverter_dc_voltage_pv1
unique_id: "solarmanpv_inverter_dc_voltage_pv1"
unit_of_measurement: 'V'
state: "{{ state_attr('sensor.solarmanpv_inverter', 'DC_Voltage_PV1') }}"
state_class: measurement
- sensor:
- name: solarmanpv_inverter_dc_current_pv1
unique_id: "solarmanpv_inverter_dc_current_pv1"
unit_of_measurement: 'A'
state: "{{ state_attr('sensor.solarmanpv_inverter', 'DC_Current_PV1') }}"
state_class: measurement
- sensor:
- name: solarmanpv_inverter_dc_voltage_testing
unique_id: "solarmanpv_inverter_dc_current_testing"
unit_of_measurement: 'V'
state: "{{ state_attr('sensor.solarmanpv_inverter', 'DC_Voltage_PV1') }}"
state_class: measurement
unit_of_measurement: 'A'
state: "{{ state_attr('sensor.solarmanpv_inverter', 'DC_Current_PV1') }}"
state_class: measurement
- sensor:
- name: solarmanpv_inverter_dc_voltage_pv2
unique_id: " solarmanpv_inverter_dc_voltage_pv2"
unit_of_measurement: 'V'
state: "{{ state_attr('sensor.solarmanpv_inverter', 'DC_Voltage_PV2') }}"
state_class: measurement
- sensor:
- name: solarmanpv_inverter_dc_current_pv2
unique_id: "solarmanpv_inverter_dc_current_pv2"
unit_of_measurement: 'A'
state: "{{ state_attr('sensor.solarmanpv_inverter', 'DC_Current_PV2') }}"
state_class: measurement
- sensor:
- name: solarmanpv_inverter_dc_power_pv1
unique_id: "solarmanpv_inverter_dc_power_pv1"
unit_of_measurement: 'W'
state: "{{ state_attr('sensor.solarmanpv_inverter', 'DC_Power_PV1') }}"
state_class: measurement
- sensor:
- name: solarmanpv_inverter_dc_power_pv2
unique_id: "solarmanpv_inverter_dc_power_pv2"
unit_of_measurement: 'W'
state: "{{ state_attr('sensor.solarmanpv_inverter', 'DC_Power_PV2') }}"
state_class: measurement
- sensor:
- name: solarmanpv_inverter_total_production
unique_id: "solarmanpv_inverter_total_production"
unit_of_measurement: 'kWh'
state: "{{ state_attr('sensor.solarmanpv_inverter', 'Cumulative_Production_(Active)') }}"
state_class: total_increasing
- sensor:
- name: solarmanpv_inverter_daily_production
unique_id: "solarmanpv_inverter_daily_production"
unit_of_measurement: 'kWh'
state: "{{ state_attr('sensor.solarmanpv_inverter', 'Daily_Production_(Active)') }}"
state_class: total_increasing
- sensor:
- name: solarmanpv_inverter_ac_radiator_temp
unique_id: "solarmanpv_inverter_ac_radiator_temp"
unit_of_measurement: '°C'
state: "{{ state_attr('sensor.solarmanpv_inverter', 'Temperature-_Inverter') }}"
state_class: measurement
- sensor:
- name: solarmanpv_inverter_ac_voltage_1
unique_id: "solarmanpv_inverter_ac_voltage_1"
unit_of_measurement: 'V'
state: "{{ state_attr('sensor.solarmanpv_inverter', 'AC_Voltage_R/U/A') }}"
state_class: measurement
- sensor:
- name: solarmanpv_inverter_ac_current_1
unique_id: "solarmanpv_inverter_ac_current_1"
unit_of_measurement: 'A'
state: "{{ state_attr('sensor.solarmanpv_inverter', 'AC_Current_R/U/A') }}"
state_class: measurement
- sensor:
- name: solarmanpv_inverter_ac_voltage_2
unique_id: "solarmanpv_inverter_ac_volgage_2"
unit_of_measurement: 'V'
state: "{{ state_attr('sensor.solarmanpv_inverter', 'AC_Voltage_S/V/B') }}"
state_class: measurement
- sensor:
- name: solarmanpv_inverter_ac_current_2
unique_id: "solarmanpv_inverter_ac_current_2"
unit_of_measurement: 'A'
state: "{{ state_attr('sensor.solarmanpv_inverter', 'AC_Current_S/V/B') }}"
state_class: measurement
- sensor:
- name: solarmanpv_inverter_ac_voltage_3
unique_id: "solarmanpv_inverter_ac_voltage_3"
unit_of_measurement: 'V'
state: "{{ state_attr('sensor.solarmanpv_inverter', 'AC_Voltage_T/W/C') }}"
state_class: measurement
- sensor:
- name: solarmanpv_inverter_ac_current_3
unique_id: "solarmanpv_inverter_ac_current_3"
unit_of_measurement: 'A'
state: "{{ state_attr('sensor.solarmanpv_inverter', 'AC_Current_T/W/C') }}"
state_class: measurement
- sensor:
- name: solarmanpv_inverter_ac_output_frequency
unique_id: "solarmanpv_inverter_ac_output_frequency"
unit_of_measurement: 'Hz'
state: "{{ state_attr('sensor.solarmanpv_inverter', 'AC_Output_Frequency_R') }}"
state_class: measurement
- Configure the energy dashboard, something like this:
As the energy dashboard refreshes on top of the hour, it could take up to 2 hours to get visuals on your dashboard as only a full hour is being visualised!
Good Luck