Stopped because of unknown reason "null" at June 27, 2022, 15:14:55 (runtime: 0.00 seconds)

I try to determine the consumption with the help of automation but get an error message:

Stopped because of unknown reason "null" at June 27, 2022, 15:14:55 (runtime: 0.00 seconds)

automation:

- id: gas_aktuell
  alias: "Gasverbrauch aktuell"
  description: "Gesamter Gasverbrauch aktuell"
  initial_state: true
  max_exceeded: silent
  trigger:
    - platform: state                 
      entity_id: sensor.wug_gasverbrauch_gesamt
  condition:    
    - condition: template
      value_template: "{{ trigger.from_state }}"
    - condition: template
      value_template: "{{ trigger.to_state }}"  
    - condition: template
      value_template: "{{ trigger.to_state.state|float(0.00) != trigger.from_state.state|float(0.00) }}"    
  variables:
    prevgas: "{{ trigger.from_state.state|float(0.00) }}"
    newgas: "{{ trigger.to_state.state|float(0.00) }}"
    gasm3: "{{(newgas - prevgas) | float(0.00) | round(3)}}"
    gaskwh: "{{((newgas - prevgas) * 10.4300) | float(0.00) | round(3)}}"
  action:
    - service: mqtt.publish
      data_template:
        topic: "tele/gasmeter/verbrauch"
        retain: false
        payload: >-
          {
            "timestamp": "{{now().strftime('%Y-%m-%d %H:%M:%S')}}",
            "state": {{gasm3}},
            "kwh": {{gaskwh}},
            "last": {{prevgas}},
            "current": {{newgas}},
            "total": {{states('sensor.wug_gasverbrauch_gesamt')|float(0.00)}},
            "power": {{states('sensor.boiler_burner_current_power')| int(0)}},
            "service-code": {{states('sensor.boiler_service_code_number')|int(0)}},
            "unit_of_measurement": "m³",
            "device_class": "gas",
            "state_class": "total_increasing",
            "device": "gasmeter",
            "app": "ha-automation_gas_aktuell",
            "operator": "zeusus.siebler.home"
          }
    - service: system_log.write
      data_template:
        message: >-
          {{ gasm3 }}	m3
        level: warning
        logger: syslog_message

Where do I make the mistake ?

I came across this when using someone’s zigbee-scene-switch blueprint(BP).

Their BP was in mode: restart, and the button was throwing 2 state changes rapidly (setting the action, and then unsetting it), so the 2nd trigger was causing the automation to restart partway through.

The symptom was that sometimes the button would trigger the light, sometimes not, but this same error popped into the logs. The solution I went with was changing the mode to “single”. I’m sure ‘queued’ or ‘parallel’ would have worked, too.

1 Like