Generic thermostat keep alive... bug?

So I’m using a broadlink rm4 pro to control a propane gas stove in my basement. All works absolutely fantastic (and WAF is through the roof since her office is down there). There’s just one small exception - that is that sometimes it doesn’t pick up the radio signal and the state gets out of sync. I think the keep_alive option should handle that scenario right?

If I understand the documentation here (https://www.home-assistant.io/integrations/generic_thermostat/) correctly, then it SHOULD send the switch on or off command repeatedly at a given interval? If that’s the case then it doesn’t appear to be working correctly.

I’ve tested it by turning the fireplace on, then unplugging the RM4, turning off the switch in home assistant then plugging it back in. My expectation is that after the timeout (1 minute in my case), the broadlink device would send an off signal but that doesn’t appear to happen.

If anyone has any suggestion I’d love to hear it. Seems like this all works for other people so I gotta think there’s something I’m doing wrong. Maybe there’s something wrong with my config? I think it’s all right, but who knows. Here’s the relevant bits:

configuration.yaml:

switch:
  - platform: template
    switches:
      fireplace:
        value_template: "{{ is_state('input_boolean.fireplace_state', 'on') }}"
        turn_on:
          # Turn on fireplace depending on selected level
          - choose:
            - conditions:
              - condition: state
                entity_id: input_select.fireplace_level
                state: low
              sequence:
                - service: script.fireplace_low
            - conditions:
              - condition: state
                entity_id: input_select.fireplace_level
                state: medium_low
              sequence:
                - service: script.fireplace_medium_low
            - conditions:
              - condition: state
                entity_id: input_select.fireplace_level
                state: medium
              sequence:
                - service: script.fireplace_medium
            - conditions:
              - condition: state
                entity_id: input_select.fireplace_level
                state: high
              sequence:
                - service: script.fireplace_high
            - conditions:
              - condition: state
                entity_id: input_select.fireplace_level
                state: ridiculous
              sequence:
                - service: script.fireplace_ridiculous
        turn_off:
          - service: script.fireplace_off

climate:
  - platform: generic_thermostat
    name: Basement
    heater: switch.fireplace
    target_sensor: sensor.basement_temperature
    cold_tolerance: 0.5
    hot_tolerance: 0.5
    min_cycle_duration: 
      minutes: 5
    keep_alive:
      minutes: 1
    precision: 0.1

scripts.yaml:

fireplace_off:
  alias: Fireplace Send Command Off
  sequence:
  - service: input_boolean.turn_off
    entity_id: input_boolean.fireplace_state
  - service: remote.send_command
    data:
      command: b64:eMCQAoLOBAAoG...........
    entity_id: remote.universal
  mode: queued
fireplace_low:
  alias: Fireplace Send Command Low
  sequence:
  - service: input_boolean.turn_on
    entity_id: input_boolean.fireplace_state
  - service: input_select.select_option
    data:
      option: low
    entity_id: input_select.fireplace_level
  - condition: state
    entity_id: climate.basement
    state: 'heat'
  - service: remote.send_command
    data:
      command: b64:d8CGArDNBAApGg4NDwwcGxsbGw4.............
    entity_id: remote.universal
  mode: queued

etc, etc.

Well I figured it out myself. After browsing the code a little, and looking at the logfile, it turns out the keepalive feature does work. But only when the climate entity is not set to “off”. If the state is “off” then the keepalive doesn’t run which sort of makes sense I guess.

Anyways, knowing that works as expected while the fireplace is actually running, I set up an automation to fire the off signal a couple extra times to be sure that it does indeed turn off. Problem solved.