FKR-12 - only open/closed. Never opening or closing

Hi all,

I have a FKR-12 that I’m trying to include in an automation but I’ve run into a problem because it only reports itself as either open or closed. It never reports its state as opening or closing while moving.

The rule I’m trying to write turns the heater off when the window is opened and closed it again if the heater is turned back on.

The problem I have is that the following occurs when the heater is turned on while the window is open.

  1. The heater turns from off to on, triggering the rule.
  2. This causes the window to begin closing and its state in HA changes from open to closed.
  3. As the window closes, it sends updates on its state, as open 20%, open 15%, etc
  4. From HA’s point of view, the window has now switched from closed back to open and this triggers the rule again, causing the heater to turn off.

I don’t think this would be an issue if the window reported to state as closing 20%, closing 15% etc…but unfortunately it doesn’t do this.

Does anyone know of a way I could code my rule to work around this? Or, is there a way to force the window to more accurately report its state?

The only way I can think of is to add wait action, to ensure the window fully closes before the rule can be re-triggered. This is a bit ugly though and could lead to an issue where the rule never finishes if the window is manually re-opened before it finishes closing.

Below is the rule in question.

alias: Heater Window Exclusivity
description: ""
trigger:
  - platform: state
    entity_id:
      - climate.heater_thermostat
    id: heater
    from: "off"
    to: heat
  - platform: state
    entity_id:
      - cover.bedroom_window_control
    id: window
    to: open
    from: closed
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: heater
        sequence:
          - service: cover.close_cover
            data: {}
            target:
              entity_id: cover.bedroom_window_control
            enabled: true
      - conditions:
          - condition: trigger
            id: window
        sequence:
          - service: climate.turn_off
            data: {}
            target:
              entity_id: climate.heater_thermostat
mode: single

You should try using the Value change on a Z-Wave JS Value Trigger. You can select this trigger option once you select the device trigger and select a Z-Wave device. You will need to get the property and value from the logs or from Z-WaveJSUI

I do a similar thing with turning my basement dehumidifier off when the garage doors are open. I typically setup a binary_sensor template with the condition - as I can then record the state, chart it, to make sure the automations work. I also add a delay, in the example below its 2 minutes. So the net is the dehumidifier turns off only if the doors are open for more than 2 minutes. As there’s not a lot of value in turning it off for a minute when we pull a car out - just thrashes the equipment - as start/stops are what wears most stuff down. Anyways you could use a similar approach to handle the cover moving by requiring it to be in a state for 30 seconds or a minute or two.

binary_sensor:
  - platform: template
    sensors:
      dehumidifier_inhibit:
        value_template: >-
          {{ (is_state("binary_sensor.workshop_door_open", "on") and (is_state("binary_sensor.garage_door_1_sensor","on") or  is_state("binary_sensor.garage_door_2_sensor","on")))  }}
        delay_on: "00:02:00"
        delay_off: "00:02:00"

And here’s the automation. I also write the automation action out to an input_text as that’s a convenient way to figure out why the dehumidifier is off.

- id: dehumidifier disable
  alias: dehumidifier disable
  trigger:
    - platform: state
      entity_id: binary_sensor.dehumidifier_inhibit
      to: "on"
      from: "off"
  action:
    - service: switch.turn_off
      target:
        entity_id: switch.switch_2_switch
    - service: input_text.set_value
      data_template:
        entity_id: input_text.dehumidifier_status
        value: "{{ 'off: disable' }}"
1 Like

This looks promising. Thanks I’ll give it a shot.

I do something similar with garage door alerts. If the garage door is open for x minutes, alert me because I’ve probably forgotten it close it.

The problem I’m having with the window and heater is that I want it to go in both directions. In your example, it would be like expanding your rule to close the door if you turn the dehumidifier on. The issue I’m having is the delay while the window opens and closes because the state of the window doesn’t reflect the fact it’s moving.

The binary sensor template will only update its state when the window has been in the same position based on the delay_on and delay_off

Take the window sensor use it as the expression for the binary sensor, figure out the right delay_on and delay_off for the application. Then create your automations.

ahhh ok, yeah, I see now. Thanks for the suggestion. It’s the best solution I’ve got so far, so will go with it for the moment.

The one issue remaining is if the following happens.

  1. Heater is off and the window is open.
  2. Heater is turned on, which triggers the window to close.
  3. Window immediately switches to “closed” but binary sensor has a 7 second off delay.
  4. Within 6 second, the window state switches to open again as it’s still closing, but the binary sensor is still within the 7 second delay, so no change there as it’s still on.
  5. Window actually closes and state correctly says closed.
  6. Binary sensor state remains on for 7 seconds due to off delay.
  7. Binary sensor state changes to off after 7 second delay

If the window were to be opened within step 6, the state of the binary sensor would already be on, which would mean the rule to turn the heater off again wouldn’t be triggered.

I looked into the other suggestion of reading the zwave data directly using the “Value change on a Z-Wave JS Value Trigger” but it looks like it only provides the position of the window. It doesn’t say if it’s moving or what direction it’s going in.
The position of the window also changes to 0 the moment the window is given the command to close.

This is my current rule

alias: Heater Window Exclusivity
description: ""
trigger:
  - platform: state
    entity_id:
      - climate.heater_thermostat
    id: heater
    from: "off"
    to: heat
  - platform: state
    entity_id:
      - binary_sensor.window_state
    id: window
    to: "on"
    from: "off"
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: heater
          - condition: device
            device_id: ee5ccae07918cd93d74422710d3bd19e
            domain: cover
            entity_id: cover.bedroom_window_control
            type: is_open
        sequence:
          - service: cover.close_cover
            data: {}
            target:
              entity_id: cover.bedroom_window_control
      - conditions:
          - condition: trigger
            id: window
        sequence:
          - service: climate.turn_off
            data: {}
            target:
              entity_id: climate.heater_thermostat
mode: restart