Rule not being triggered by command?

  • Platform information:
    • Hardware: Raspberry Pi 3
    • OS: OpenHABian
    • openHAB version: 3.0.2

I have created 2 test rules for my 2 Nest thermostats. One rule sends a command to cycle ON the HVAC for one thermostat. The other rule is supposed to be triggered by the thermostat cycling on, and is supposed to cycle OFF the other thermostat and run a script to change its setpoint (so that it doesn’t immediately just cycle back on).

The first rule is as follows:

triggers: []
conditions: []
actions:
  - inputs: {}
    id: "1"
    configuration:
      itemName: Downstairs_Status
      command: COOLING
    type: core.ItemCommandAction

The second rule is:

triggers:
  - id: "1"
    configuration:
      itemName: Downstairs_Status
      command: cooling
    type: core.ItemCommandTrigger
conditions: []
actions:
  - inputs: {}
    id: "4"
    configuration:
      type: application/vnd.openhab.dsl.rule
      script: >-
        logInfo("TEST Reset Upstairs - Start", "Detected Downstairs cycling on.
        Attempting to reset Upstairs_Setpoint. Current setpoint state = " +
        Upstairs_Setpoint.state)
          
        var setpoint = (Upstairs_Setpoint.state as QuantityType<Number>).toBigDecimal
        var offset = (DR_Cooling_Offset_degF.state as QuantityType<Number>).toBigDecimal
        setpoint = setpoint + offset

        if (setpoint > 90.0)
        {
          logInfo("TEST Reset Upstairs [WARNING]", "new setpoint (" + setpoint + ") may be higher than the max cooling setpoint allowed by the thermostat. The change may not take effect.")
        }
        sendCommand(Upstairs_Setpoint, setpoint)

        logInfo("TEST Reset Upstairs - End", "Finished resetting Upstairs_Setpoint. New setpoint state = " + Upstairs_Setpoint.state)
    type: script.ScriptAction
  - inputs: {}
    id: "2"
    configuration:
      itemName: Upstairs_Status
      command: OFF
    type: core.ItemCommandAction

When I run the first rule, I would expect that the 2nd rule would trigger and turn off the other othermostat. But nothing happens. The Downstairs tstat shows that it cycles to COOLING, but the item states for the Upstairs tstat do not change in the OpenHAB portal, nor does the actual thermostat reset.

I checked the logs (from /var/log/openhab/openhab.log on the PRi), and it doesn’t show anything. There are no errors, but none of my info statements are logged. It looks like rule 2 is never running.

If I manually run rule 2 (by clicking the “play” icon button in the rule Design screen), it does correctly change the cycle of the tstat and reset its setpoint. All my log statements show up in the log if I run it manually. So I don’t think there’s a problem with the rule itself; it just isn’t getting triggered by its respective trigger.

Do I have something configured wrong? Why isn’t this 2nd rule triggering?

Upstairs_Status and Downstairs_Status are both items that are linked to the respective tstat’s “HVAC Status” channel, and Upstairs_Setpoint is an item that is linked to both the upstairs tstat’s “Cool Temperature” and “Target Temperature” channels. Should I only link setpoint to one or the other, but not both?

Don’t match. Al this stuff is case sensitive.

2 Likes

I had tried both upper case and lower case, but it wasn’t working before. I matched the casing, and it seems to be working now. Maybe there was some other problem before that I had already fixed. Anyway, good to know that I should always match casing.

1 Like