Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The option last_reset_value_template cannot be used together with state class total_increasing' when processing MQTT #210

Open
Ducatel opened this issue Dec 1, 2024 · 0 comments

Comments

@Ducatel
Copy link

Ducatel commented Dec 1, 2024

Hi

I'm trying to push my data to mqtt server which is used by Home assistant.

In HA, I face theses errors:

Error 'The option `last_reset_value_template` cannot be used together with state class `total_increasing`' when processing MQTT discovery message topic: 'homeassistant/sensor/A228055402_daily_export_to_grid/config', message: '{'state_topic': 'SunGather/A228055402', 'value_template': '{{ value_json.daily_export_to_grid | round(2) }}', 'device_class': 'energy', 'icon': 'mdi:transmission-tower-export', 'last_reset_value_template': '{{ value_json.last_reset }}', 'state_class': 'total_increasing', 'unique_id': 'sungather_daily_export_to_grid_A228055402', 'unit_of_measurement': 'kWh', 'device': {'manufacturer': 'Sungrow', 'model': 'SG60RS', 'identifiers': 'A228055402', 'via_device': 'SunGather', 'connections': [['address', '192.168.1.8']], 'name': 'Sungrow SG60RS'}, 'name': 'Daily Export to Grid'}'
Error 'The option `last_reset_value_template` cannot be used together with state class `total_increasing`' when processing MQTT discovery message topic: 'homeassistant/sensor/A228055402_daily_import_from_grid/config', message: '{'state_topic': 'SunGather/A228055402', 'value_template': '{{ value_json.daily_import_from_grid | round(2) }}', 'device_class': 'energy', 'icon': 'mdi:transmission-tower-import', 'last_reset_value_template': '{{ value_json.last_reset }}', 'state_class': 'total_increasing', 'unique_id': 'sungather_daily_import_from_grid_A228055402', 'unit_of_measurement': 'kWh', 'device': {'manufacturer': 'Sungrow', 'model': 'SG60RS', 'identifiers': 'A228055402', 'via_device': 'SunGather', 'connections': [['address', '192.168.1.8']], 'name': 'Sungrow SG60RS'}, 'name': 'Daily Import from Grid'}'

seems coming from the mqtt ha_sensor config.
I took it from the config sample:

- name: "Daily Export to Grid"
        sensor_type: sensor
        register: daily_export_to_grid
        device_class: energy
        state_class: total_increasing
        icon: "mdi:transmission-tower-export"
        value_template: "{{ value_json.daily_export_to_grid | round(2) }}"
        last_reset_value_template: "{{ value_json.last_reset }}"
      - name: "Daily Import from Grid"
        sensor_type: sensor
        register: daily_import_from_grid
        device_class: energy
        state_class: total_increasing
        icon: "mdi:transmission-tower-import"
        value_template: "{{ value_json.daily_import_from_grid | round(2) }}"
        last_reset_value_template: "{{ value_json.last_reset }}"

Should I remove the last_reset_value_template which seems to not be compatible with the state class ?

Thanks in advance for your help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant