Skip to content

Suppress SML MQTT publish until valid meter data received#24587

Merged
arendst merged 1 commit intoarendst:developmentfrom
milindur:feat/suppress-sml-mqtt-until-valid
Mar 25, 2026
Merged

Suppress SML MQTT publish until valid meter data received#24587
arendst merged 1 commit intoarendst:developmentfrom
milindur:feat/suppress-sml-mqtt-until-valid

Conversation

@milindur
Copy link
Copy Markdown
Contributor

@milindur milindur commented Mar 24, 2026

Description:

Use existing dvalid[] array to gate JSON and immediate MQTT output, preventing initial zero values from corrupting HA statistics on restart.

Checklist:

  • The pull request is done against the latest development branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • The code change is tested and works with Tasmota core ESP8266 V.2.7.8
  • The code change is tested and works with Tasmota core ESP32 V.3.1.10 / V.3.3.7
  • I accept the CLA.

Use existing dvalid[] array to gate JSON and immediate MQTT output,
preventing initial zero values from corrupting HA statistics on restart.

Signed-off-by: Christian Andersen <public@milindur.de>
@milindur
Copy link
Copy Markdown
Contributor Author

I tested this with an ESP32-based bitshake SmartMeterReader and a heat meter.

gemu2015 added a commit to gemu2015/Sonoff-Tasmota that referenced this pull request Mar 25, 2026
…ived

- SML_Immediate_MQTT: early return if dvalid[index] is not set
- SML_Show: track group_open state to correctly gate JSON output
- Skip meter values not yet received from meter (dvalid check)
- Only close/open JSON groups when valid data is present
- Prevents initial zero values from corrupting HA statistics on restart

Source: arendst#24587 (milindur)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gemu2015
Copy link
Copy Markdown
Contributor

i test it and it can be merged

@arendst arendst merged commit 3b92a13 into arendst:development Mar 25, 2026
64 checks passed
@milindur milindur deleted the feat/suppress-sml-mqtt-until-valid branch March 25, 2026 12:29
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

Successfully merging this pull request may close these issues.

3 participants