@scottdube If your code is allowed to block during the wait, the implementation can be very straightforward (untested):
// ...setup etc...
void loop()
{
static int prevState = LOW;
int state = digitalRead(ZwavePin);
if (state != prevState)
{
// ZWavePin state has changed
// Determine target state of relay
const int pinState = (state == HIGH) ? LOW : HIGH;
// Set Fire relay
digitalWrite(FirePin, pinState);
// Wait some ms
delay(5000);
// Set Fan relay
digitalWrite(FanPin, pinState);
// Remember current ZWavePin state to be able to detect changes
prevState = state;
}
}
As your description doesn't mention the source of the ZWavePin, it might require debouncing if it is a mechanical switch.