Sitemap, Setpoint and RF control

Hello Friends,
I’m trying to configure my sitemap to control a RF controlled gas fire heater.
I installed the Broadlink Binding to learn the heater’s RF remote codes and I’m able to control it properly. I defined two RF commands: “fire_heater_h” raises the fire intensity, and “fire_heater_l” lowers the fire intensity.
My next step is to add a line to my sitemap to raise and lower the fire intensity.
I first tried this option:

Switch item=rf_control label="Fire ▲/▼[]" mappings=[fire_heater_h="▲",fire_heater_h="▲",fire_heater_l="▼",fire_heater_l="▼"] icon="none"

which works, but is not ideal, because I can’t press the same button twice consecutively (that’s why I made double buttons for each command).

The second method I thought of using is Setpoint.
Is there a way to define the Setpoint up/down buttons to send the RF commands I defined for “fire_heater_h” and “fire_heater_l” ?

Hope someone can help :pray:

One thing that came to my mind would be to configure a rule like this:

rule "Reset button state"
    Item rf_control received Command
    rf_control.postUpdate("###State that is not fire_heater_h or fire_heater_l as a default state###") //like null or default or anything else

then edit the sitemap to
Switch item=rf_control label="Fire ▲/▼[]" mappings=[fire_heater_h="▲",fire_heater_l="▼"] icon="none"

Since you already have the [] in your label you would not see the default button state and would be able to press fire_heater_h and fire_heater_l as many times as needed.

1 Like

I had the same thought as Felix: basically, reset the command to a different value after each button-press.

This could work. You’d need a virtual number item that would be shown on the sitemap, and then a rule to actually send the command to your heater based on the sitemap input. You could use newState and previousState to do that.

 virtual_item changed
 if (newState > previousState) { rf_control.sendCommand("fire_heater_h" }
 else if (newState < previousState) { rf_control.sendCommand("fire_heater_l" }

The point of the virtual item would just be to identify up and down commands, so its state doesn’t actually matter. It would only be a problem if the virtual item hit the minimum or maxium of the setpoint, and you can probably work out ways around that.

1 Like

Thank you very much for the suggestion!
I will test them next week when I’m back home :pray::pray:

I didn’t mention it yesterday, but you could also use virtual items to store the current state of the fire heater if it has minimums and maximums. Then instead of incrementing, you could actually specify “60%” or “medium” and have openHAB send commands to get it to the right spot. I do something similar with an IR controlled fan that I wanted to control via Google Assistant.

The limitation to this is that you can only control the fire heater using openHAB, because if you use other controls it will get out of sync.

1 Like