Question, ESPhome how to stop internal sending state

I have a fast polling sensor that i want to integrate at 1s intervals, and publish the value every 60s
i also want to filter the sensor using a 30point moving avg - but separate to the integrate

  - platform: mppt (this is my own external component)
    update_interval: 1s
    charge_current:
      id: charge_current
      internal: true

  - platform: integration
    name: ${disp_name} Coulomb Counter
    sensor: charge_current
    time_unit: s
    filters:
      - throttle: 60s

  - platform: template
    name: ${disp_name} Charge Current
    lambda: return(id(charge_current).state);
    filters:
      - sliding_window_moving_average:
          window_size: 30
          send_every: 30

i thought the internal: true and not having a name would do it… but my logs are slammed with

[21:51:06][D][sensor:124]: 'charge_current': Sending state -0.08000 A with 3 decimals of accuracy
[21:51:07][D][sensor:124]: 'charge_current': Sending state -0.07200 A with 3 decimals of accuracy
[21:51:08][D][sensor:124]: 'charge_current': Sending state -0.07300 A with 3 decimals of accuracy
[21:51:09][D][sensor:124]: 'makerpower-mppt Load Current': Sending state 0.07870 A with 3 decimals of accuracy
[21:51:09][D][sensor:124]: 'charge_current': Sending state -0.07300 A with 3 decimals of accuracy
[21:51:10][D][sensor:124]: 'charge_current': Sending state -0.07700 A with 3 decimals of accuracy
[21:51:11][D][sensor:124]: 'charge_current': Sending state -0.07400 A with 3 decimals of accuracy
[21:51:12][D][sensor:124]: 'charge_current': Sending state -0.07700 A with 3 decimals of accuracy
[21:51:13][D][sensor:124]: 'charge_current': Sending state -0.07700 A with 3 decimals of accuracy
[21:51:14][D][sensor:124]: 'charge_current': Sending state -0.07500 A with 3 decimals of accuracy
[21:51:15][D][sensor:124]: 'charge_current': Sending state -0.07400 A with 3 decimals of accuracy

Edit:

The other issue with this approach is i lose the inheritance from the sensor and need to set manually.

  - platform: integration
    name: ${disp_name} Coulomb Counter
    sensor: charge_current
    time_unit: s
    restore: true
    min_save_interval: 300s
    filters:
      - throttle: 60s
      
  - platform: template
    name: ${disp_name} Charge Current
    lambda: return(id(charge_current).state);
    unit_of_measurement: A
    accuracy_decimals: 3
    device_class: current
    state_class: measurement
    update_interval: 1s
    filters:
      - sliding_window_moving_average:
          window_size: 30
          send_every: 30

what im thinking is something like this… but this will Not work because the integration requires a sensor object…

  - platform: mppt (this is my own external component)
    update_interval: 1s
    charge_current:
        name: ${disp_name} Charge Current
        filters:
          - sliding_window_moving_average:
              window_size: 30
              send_every: 30

  - platform: integration
    name: ${disp_name} Coulomb Counter
    sensor: id(charge_current).raw_state
    time_unit: s
    restore: true
    min_save_interval: 300s
    filters:
      - throttle: 60s

1 Like

Would this stop the log entries

In not sure it will, I really need to see the other debug messages from the same component