RFXcom and the MCZ pellet stove

Rfxtrx433e

Update so the counter resets after reaching 255


alias: MCZ
description: ""
triggers:
  - entity_id:
      - input_button.mcz_send_to_stove
    trigger: state
  - entity_id:
      - input_boolean.mcz_mode
    trigger: state
conditions: []
actions:
  - if:
      - condition: numeric_state
        entity_id: counter.mcz_counter
        above: 254
    then:
      - action: counter.reset
        metadata: {}
        data: {}
        target:
          entity_id: counter.mcz_counter
    else:
      - action: counter.increment
        metadata: {}
        data: {}
        target:
          entity_id: counter.mcz_counter
  - action: rfxtrx.send
    metadata: {}
    data:
      event: >-
        0C4300{{  "%02x" | format( states('counter.mcz_counter') | int) }}{{
        states('input_text.mcz_id') | string }}{% if
        states('input_boolean.mcz_beep') == 'off' %}00{% else %}01{% endif %}{{
        "%02x" | format( states('input_number.mcz_fan') | int) }}11{{ "%02x" |
        format( states('input_number.mcz_flame_power') | int) }}{% if
        states('input_boolean.mcz_mode') == 'off' %}00{% else %}01{% endif %}00
    enabled: true
mode: single