Is there anyway to use directly 433 with openhab --- serial gateway will be 433 receiver and transmitter (without mysensors lib and devices)
@static418 Thank you for your idea.
Create 2 maps, if one is null then get other map.
I removed ";" things because i dont need them.
var HashMap<String, String> CodeToItemsMapOn = newLinkedHashMap(
"14013452"->"SOKET_1",
"SOKET_1"->"14013452"
)
var HashMap<String, String> CodeToItemsMapOff = newLinkedHashMap(
"14013443"->"SOKET_1",
"SOKET_1"->"14013443"
)
var HashMap<String, String> CodeToActionMap = newLinkedHashMap( //nothing important because there is no duplicate
"14013452"->"ON",
"ON"->"14013452",
"14013443"->"OFF",
"OFF"->"14013443"
)
//remember hashmaps must be out of the rule
rule "Arduino sends to Openhab"
when
Item Arduino received update
then
.........
if(subType==V_VAR1){
var myOrder=CodeToItemsMapOn.get(msg) //1.map
if(myOrder==null){myOrder=CodeToItemsMapOff.get(msg)} //2.map
postUpdate(myOrder,CodeToActionMap.get(msg)) //make you job
}
.......
end
This code is only for updating the openhab screen (receiving), i will work for transmit.
You can find more on https://github.com/openhab/openhab/wiki/Taking-Rules-to-New-Heights
There is another problem with CodeToActionMap; If i got a lot of outlets this means many on and off commands ..
rule "MY ON"
when
Item SOKET_1 received command ON
then
sendCommand(Arduino, "105;105;1;0;24;" + 14013452 + "\n")
end
rule "MY OFF"
when
Item SOKET_1 received command OFF
then
sendCommand(Arduino, "105;0;1;0;24;" + 14013443 + "\n")
end`
These rules for TRANSMIT didnt work any idea???