Switch with different items for ON / OFF / State and Home Kit Integration

Hey,

I am pretty new to openhab and start learning to get deeper inside. I have one specific problem that seems to be working but in my case I do not find the example I can directly use 1:1 (Documentation and Search)
I hope you can help me to find a solution for my problem.
I have the Neeo (Universal remote) Binding installed. Neeo is similiar to harmony in respective of scenes. In the binding I have different items, more specific for one scene I have three items I want to use.

  • First item: Start scene with command ON
    channel: neeo:room-6333765427717472256:5b1b2dce:room:recipe-6367775083724800000#status
  • Second item: End scene with command ON
    channel: neeo:room-6333765427717472256:5b1b2dce:room:recipe-6367775083745771520#status
  • Third item: Status of scene if it is turned on (command ON) or Off (command OFF)
    channel: neeo:room-6333765427717472256:5b1b2dce:room:scenario-6367775083439587328#status

In my solution I would like to have a “dummy” switch that triggers with COMMAND ON- first item, with COMMAND OFF - second item and the latest state with third item, as I also use the remote control and the state wouldn’t match otherwise.

I could trigger scenes with with rules but as I understand I can reoresent all the scenario with just one switch.

I hope I could make it clear what I mean. I guess the I will leave the second step (Integration in HomeKit besids so far)

Thanks in advance for any suggestions.
Patrick

Create a rule and a dummy switch

Switch dummySwitch
rule "scenes"
when
    Item dummySwitch changed
then
    if (triggeringItem.state == ON) firstItem.sendCommand(ON)
    if (triggeringItem.state == OFF) secondItem.sendCommand(ON)
end

First of all thanks for the blazing fast reply. :slight_smile:

But it will not represent the correct state if I use the remote itself. Or do I got your rule wrong?

I missed that you need another rule to catch the remote and reflect the state.

That was the reason that I thought another solution would be make more sense.
As well as I want to extend it to KNX. But I want to make one step after the other and understand how it develop.

rule "scenes"
when
    Item dummySwitch changed
then
    if (triggeringItem.state == ON) {
        firstItem.sendCommand(ON)
        thirdItem.sendCommand(ON)
    }
    if (triggeringItem.state == OFF) {
        secondItem.sendCommand(ON)
        thirdItem.sendCommand(OFF)
    }
end

I think that’s what you want to achieve.

1 Like

I have a few questions coming up again. But it doesn’t make sense to ask until I am able to check the rule. And to think about how to integrate the KNX Binding as well. I try to work it out, this evening.

Thank you very much so far. I will try to integrate and will give you an update about my result. ;))

Just to show my solution so far as I had not much time atm:

I did the switch with http request in the end.
Switch SkyREST (SG_LivingRoom) [ “Switchable” ] { http=">[ON:POST:http://IP/rest/items/neeo_room_6333765427717472256_5b1b2dce_room_recipe_6367775083724800000_status:ON] >[OFF:POST:http://IP/rest/items/neeo_room_6333765427717472256_5b1b2dce_room_recipe_6367775083745771520_status:ON]" }

And state update with a rule so far (including KNX).
rule “Sky”
when
Item neeo_room_6333765427717472256_5b1b2dce_room_scenario_6367775083439587328_status changed
then
if (neeo_room_6333765427717472256_5b1b2dce_room_scenario_6367775083439587328_status.state == ON) {
SkyREST.postUpdate(ON)
knx_device_5e54cd27_NEEO_SKY_KNX_STATUS.postUpdate(ON)
}
if (neeo_room_6333765427717472256_5b1b2dce_room_scenario_6367775083439587328_status.state == OFF) {
SkyREST.postUpdate(OFF)
knx_device_5e54cd27_NEEO_SKY_KNX_STATUS.postUpdate(OFF)
}

I have a lot of problems with the new KNX binding. I have to make a clean install of openhab first to check go further.