שלום לכולם, עברתי על מדריך לחיבור סצנות שקיימות אצלי על ההרמוני האב כדי שיופיע לי בהום קיט ואוכל להפעיל אותן משם.
ב home.items הוספתי את הקוד הבא :
// Logitech Harmony Hub - Living Room
Switch HarmonyHubhome_TV "טלויזיה" [ "Switchable" ]
Switch HarmonyHubhome_Movies "מקרן" [ "Switchable" ]
String HarmonyHubhome "Current Activity [%s]" { channel="harmonyhub:hub:home:currentActivity"}
כאשר סצינת הטלויזיה היא TV וסצינת המקרן היא movies (גם באפיקציה של הרמוני)
aני הכפתורים מופיעים לי בהום קיט ואפשר להדליק ולכבות אותם שם, אבל, אין חיבור ל openhab ושום דבר לא קורה.
הוספתי גם בקובץ ה rules :
rule "Living Room TV Start"
when
Item HarmonyHubhome_TV changed from OFF to ON
then
{
HarmonyHubhome.sendCommand("TV")
}
end
rule "Living Room projector Start"
when
Item HarmonyHubhome_Movies changed from OFF to ON
then
{
HarmonyHubhome.sendCommand("Movies")
}
end
rule "Living Room projector Stop"
when
Item HarmonyHubhome_Movies changed from ON to OFF
then
{
HarmonyHubhome.sendCommand("PowerOff")
}
end
rule "Living Room TV Stop"
when
Item HarmonyHubhome_TV changed from ON to OFF
then
{
HarmonyHubhome.sendCommand("PowerOff")
}
מה אני מפספס?
צריך עזרה בחיבור harmony hub ל homekit על openhab
- dondi (פותח השרשור)
-
- חבר ותיק
- הודעות: 1968
- הצטרף: פברואר 2005
- נתן תודות: 38 פעמים
- קיבל תודות: 67 פעמים
עדכון, שכחתי להכניס את שרת ה if
להלן הקוד הנכון
rule "Living Room TV Start"
when
Item HarmonyHubhome_TV changed from OFF to ON
then
if (HarmonyHubhome.state != "TV")
{
HarmonyHubhome.sendCommand("TV")
}
end
rule "Living Room projector Start"
when
Item HarmonyHubhome_Movies changed from OFF to ON
then
if (HarmonyHubhome.state != "Movies")
{
HarmonyHubhome.sendCommand("Movies")
}
end
rule "When all Living Room devices are off"
when
Item HarmonyHubhome_TV changed from ON to OFF or
Item HarmonyHubhome_Movies changed from ON to OFF
then
Thread::sleep(250)
if (HarmonyHubhome.state != "PowerOff")
{
if (HarmonyHubhome.state == "TV" && HarmonyHubhome_TV.state == OFF) {
HarmonyHubhome.sendCommand("PowerOff")
}
if (HarmonyHubhome.state == "Movies" && HarmonyHubhome_Movies.state == OFF) {
HarmonyHubhome.sendCommand("PowerOff")
}
}
end
בעיה חדשה שצצה. סירי מזהה את המילה ״טלויזיה״ ורוצה לשלוט באפל טיוי ולא מפעילה את הטלויזיה (בלחיצה על הכפתור שקיים זה כן עובד) יש פתרון יצירתי שסירי לא תחפש את האפל טיוי?
להלן הקוד הנכון
rule "Living Room TV Start"
when
Item HarmonyHubhome_TV changed from OFF to ON
then
if (HarmonyHubhome.state != "TV")
{
HarmonyHubhome.sendCommand("TV")
}
end
rule "Living Room projector Start"
when
Item HarmonyHubhome_Movies changed from OFF to ON
then
if (HarmonyHubhome.state != "Movies")
{
HarmonyHubhome.sendCommand("Movies")
}
end
rule "When all Living Room devices are off"
when
Item HarmonyHubhome_TV changed from ON to OFF or
Item HarmonyHubhome_Movies changed from ON to OFF
then
Thread::sleep(250)
if (HarmonyHubhome.state != "PowerOff")
{
if (HarmonyHubhome.state == "TV" && HarmonyHubhome_TV.state == OFF) {
HarmonyHubhome.sendCommand("PowerOff")
}
if (HarmonyHubhome.state == "Movies" && HarmonyHubhome_Movies.state == OFF) {
HarmonyHubhome.sendCommand("PowerOff")
}
}
end
בעיה חדשה שצצה. סירי מזהה את המילה ״טלויזיה״ ורוצה לשלוט באפל טיוי ולא מפעילה את הטלויזיה (בלחיצה על הכפתור שקיים זה כן עובד) יש פתרון יצירתי שסירי לא תחפש את האפל טיוי?