Pulse counter to current usage

Thanks Tom… It was a long time ago since I was in math class :slight_smile:

All working fine now

Thank you all for your help…

1 Like

Are you sure your calculation is correct? What is your time-interval?

You are supposed calculate like this: sensor_value * 0.1 * (time_interval in seconds / 3600)
Or shorter: sensor_value * (time_interval in seconds / 36000)

Also, this is (only) valid when using the derivative-sensor, I have no idea what the output means of the statistics sensor.

As bouwew says you can use the derivative platform

  • platform: derivative
    source: sensor.s0pcm_channel_6
    name: ‘Demanded power’
    unit: W
    unit_time: h

Hi,

Did you get this to work properly?
I can’t see that mine is working at all.

What am I missing?

sensor:
#  - platform: derivative
#    source: sensor.rfxmeter_count_2e_counter_value
#    name: RFXMeter change per hour
#    round: 1
#    unit_time: h # the resulting "unit_of_measurement" will be °C/h if the sensor.temperate has set °C as it's unit
#    time_window: "00:01:00"  # we look at the change over the last half hour
    
  - platform: statistics
    entity_id: sensor.rfxmeter_count_2e_counter_value
    precision: 3
    max_age:
      minutes: 15
      
  - platform: template
    sensors:
      rfxmeter:
        friendly_name: "RFXMeter"
        value_template: "{{ state_attr('sensor.rfxmeter_count_2e_counter_value','change_rate') |float * 0.1 * 3600 | round(0)}} Watt"