Comments (2)
HI @Tazintosh,
what you are trying is not something that can be achieved in this plugin. I just introduced a communication layer, showing items from openHAB in HomeKit, but since you have four different items in openHAB those are shown as 4 items in HomeKit as well.
Preface: I hope I understand your setup correctly and I did not directly test all of those rules (there might be syntax errors in there), since I don't have access to your environment, just trying to give you an understanding, so you can go and find the best way for you. Since this is at it's core an openHAB question, feel free to contact the nice folks over at the openHAB community
I would suggest creating a proxy item in one of your item files without specifying any binding (The other three items should already be defined with your respective binding, not sure just guessing here):
led.items
Color myLEDProxyItem
Switch myLEDPower {<<yourbinding>>}
Color myLEDColor {<<yourbinding>>}
Dimmer myLEDBrightness {<<yourbinding>>}
(The myLEDProxyItem
would be the one item you would add to your home bridge configuration)
Then you would create a rule, that monitors incoming commands to your proxy item and push them to your other items, while changing your proxy item if your other items are changed.
led.rules
import java.lang.Integer
import java.lang.NumberFormatException
rule 'incoming proxy request'
when
Item myLEDProxyItem received command
then
if (receivedCommand == "ON" || receivedCommand == "OFF") {
myLEDPower.sendCommand(receivedCommand);
} else {
try {
val int num = Integer.parseInt(receivedCommand)
myLEDBrightness.sendCommand(receivedCommand);
// not sure if your accessory is 'smart enough' to also trigger the switch on, when a brightness is set, if not you would need something like this:
if(receivedCommand > 0) {
myLEDPower.sendCommand("ON");
} else {
myLEDPower.sendCommand("OFF");
}
} catch (NumberFormatException e) {
// String is not a number
//now this should be a color couple, as mentioned above, if your items are not 'smart enough', you would need to parse the 'receivedCommand' and perform brightness and power settings as well, I am a little bit lazy at the moment, therefore I would suggest you to give it a try, feel free to post if you can't find a solution :P
myLEDColor.sendCommand(receivedCommand);
}
end
rule "brightness led changed"
when
myLEDBrightness changed
then
myLEDProxyItem.postUpdate(myLEDBrightness.state);
end
rule "power led changed"
when
myLEDPower changed
then
myLEDProxyItem.postUpdate(myLEDPower.state);
end
rule "color led changed"
when
myLEDColor changed
then
myLEDProxyItem.postUpdate(myLEDColor.state);
end
As said earlier, I did this quickly while on the train without really checking it, but it should give you an idea how to create and keep proxy items in sync. I hope that helped.
from homebridge-openhab2-complete.
Hi @steilerDev,
I'm happy you did not put much time into this but still, I'm sure it will help some other people that were in my case. The proxy concept is cool, I was clearly missing this.
Anyway, since more than 2 weeks, my configuration has much evolved.
In fact, I've dropped Openhab for now. The learning curve was way to long, for unsatisfying results (sadly) an big needs (need to learn new language to write rules etc.)
I've installed Node-RED and the overall experience is immensely better (not speaking writing rules were functions are just javascript). The HomeKit palette "node-red-contrib-homekit-bridged" is a real pleasure, producing a "native" HomeKit device with all expectations.
Thanks @steilerDev
from homebridge-openhab2-complete.
Related Issues (20)
- Homebridge crash with ReferenceError: url is not defined HOT 1
- Thermostat errors - when trying to allow Heating (on Off and Auto) HOT 3
- README Install command small fixes HOT 1
- Documentation for irrigation items is wrong HOT 2
- 'Current Heater-Cooler State' didn't respond at all HOT 8
- Heater/Cooler Swing not working HOT 5
- After update to iOS 15 asking for current room temperature fails and only replies with "Heating is off" HOT 3
- item not deleted after label is changed - creating duplicate HOT 1
- Add Multiplier Option to Humidity Values
- Heater/Cooler Accessory with sepparate min-max temp for thresholds HOT 5
- Connection with OpenHabian3 HOT 6
- Switch from OpenHAB is not synced to Homebridge HOT 2
- Devices don't turn on/off HOT 2
- Color of Lamp is recognized as Brightness HOT 1
- when new accessories added old ones that were on the dashboard dissappear HOT 3
- OH3 Support? HOT 1
- Temperature sensor no response HOT 1
- Speaker Object doesn't show volume controls HOT 5
- Invalid JSON in an platform Oliver HOT 2
- request still used in OpenHab.js HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homebridge-openhab2-complete.