Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.
This repository was archived by the owner on Sep 6, 2023. It is now read-only.

Add a periodic guard 'only_every'  #356

@boc-tothefuture

Description

@boc-tothefuture

Add an additional guard type named 'only_every' that will prevent execution of the rule if it triggers again within that duration.

current:

rule 'Cycle HVAC fan for office' do 
    changed [Office_Temperature, Thermostats_Upstairs_Temp, Office_Occupied]
    run do 
        logger.debug("Turning on HVAC air cycle upstairs to balance temperature")
        Buttons_Circ_2nd.on
        last_run = now()
    end 
    only_if { (Office_Temperature - Thermostats_Upstairs_Temp).abs > '2 °F'}
    only_if Office_Occupied
    not_if  Thermostats_Upstairs_Status
    not_if Thermostats_Upstairs_Fan_Mode
    only_if { (now() - last_run) > 2.hours }
end

proposed:

rule 'Cycle HVAC fan for office' do 
    changed [Office_Temperature, Thermostats_Upstairs_Temp, Office_Occupied]
    run do 
        logger.debug("Turning on HVAC air cycle upstairs to balance temperature")
        Buttons_Circ_2nd.on
    end 
    only_if { (Office_Temperature - Thermostats_Upstairs_Temp).abs > '2 °F'}
    only_if Office_Occupied
    not_if  Thermostats_Upstairs_Status
    not_if Thermostats_Upstairs_Fan_Mode
    only_every 2.hours
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions