Sp0rNy
(Sporny)
April 26, 2017, 1:18am
1
Hi Community,
i have 3 433mhz sockets controlled via openhab2 (openhabian on RaspberryPi).
I can control them via the openhab app.
My Homekit can find the server and i can add the sockets (as lights). But i cant control them via apple homekit.
Here are my files:
.sitemap
sitemap steckdosen label="Steckdosen" {
Frame label="Funksteckdosen Gruppe G" {
Switch item=steckdoseG1Switch mappings=[ "ON"="ON", "OFF"="OFF" ]
Switch item=steckdoseG2Switch mappings=[ "ON"="ON", "OFF"="OFF" ]
Switch item=steckdoseG3Switch mappings=[ "ON"="ON", "OFF"="OFF" ]
}
}
.items
Group grp_steckdosen "Steckdosen" <poweroutlet>
String steckdoseG1Switch "Steckdose G1" <poweroutlet> (grp_steckdosen) [ "Switchable" ] { channel="exec:command:steckdoseG1-control:input", channel="exec:command:steckdoseG1-status:output", autoupdate="true" }
String steckdoseG2Switch "Steckdose G2" <poweroutlet> (grp_steckdosen) [ "Switchable" ] { channel="exec:command:steckdoseG2-control:input", channel="exec:command:steckdoseG2-status:output", autoupdate="true" }
String steckdoseG3Switch "Steckdose G3" <poweroutlet> (grp_steckdosen) [ "Switchable" ] { channel="exec:command:steckdoseG3-control:input", channel="exec:command:steckdoseG3-status:output", autoupdate="true" }
.things
//SteckdoseG1
Thing exec:command:steckdoseG1-control [ command="/home/openhabian/433Utils/RPi_utils/steckdose1.sh %2$s", interval=0, autorun=true ]
Thing exec:command:steckdoseG1-status [ command="/home/openhabian/433Utils/RPi_utils/steckdose1.sh status", interval=0, timeout=5 ]
//SteckdoseG2
Thing exec:command:steckdoseG2-control [ command="/home/openhabian/433Utils/RPi_utils/steckdose2.sh %2$s", interval=0, autorun=true ]
Thing exec:command:steckdoseG2-status [ command="/home/openhabian/433Utils/RPi_utils/steckdose2.sh status", interval=0, timeout=5 ]
//SteckdoseG3
Thing exec:command:steckdoseG3-control [ command="/home/openhabian/433Utils/RPi_utils/steckdose3.sh %2$s", interval=0, autorun=true ]
Thing exec:command:steckdoseG3-status [ command="/home/openhabian/433Utils/RPi_utils/steckdose3.sh status", interval=0, timeout=5 ]
.sh
#!/bin/sh
if [ "$1" = "off" ] || [ "$1" = "0" ] || [ "$1" = "OFF" ]; then
/home/openhabian/433Utils/RPi_utils/codesend 7721987
else
/home/openhabian/433Utils/RPi_utils/codesend 7721996
fi
maybe someone can help me
Sp0rNy
(Sporny)
April 26, 2017, 5:05pm
2
still cant find out whats wrong… can find all my items/things in apple homekit, but they dont react on the inputs
LuFriFri
(Lutz Fricke)
April 27, 2017, 7:03pm
3
I think “String”-Items are not possible - use Switch instead
Sp0rNy
(Sporny)
April 27, 2017, 7:11pm
4
So only change “String” to “Switch” in .items?
EDIT: when i change it to switch the sockets dont react on the command
Sp0rNy
(Sporny)
May 6, 2017, 12:45pm
5
Okay now i have a amazon echo dot… but it needs switchable items in the sitemap… so how can i change the items/things to make it as switch?
myon99
(marco)
May 11, 2017, 9:33pm
6
Same problem here. Within the openhab.log the following error is shown:
[ERROR] [ssories.AbstractHomekitAccessoryImpl] - Type XYZSwitch is a org.eclipse.smarthome.core.library.items.StringItem instead of the expected org.eclipse.smarthome.core.library.items.SwitchItem
I know from the homekit description that String is not allowed for Switches, but how to implement the excec binding then? Keep in mind, it’s working for the OpenHab UIs and app.
LuFriFri
(Lutz Fricke)
May 12, 2017, 3:45pm
7
I do not know how to do that, but maybe a workaround helps?
Define a Switch-Item with no binding and use this for homekit.
Define then a rule for that to actually switch your item.
This settings work for me with amazon echo. So it should work with himekit too because its the same problem with string and switch. In short words…i defined a dummy switch which triggers the “real” switch by a rule.
.items:
String steckdoseG2Switch “Wohnzimmerlampe 1” (grp_steckdosen) [ “Switchable” ] { channel=“exec:command:steckdoseG2-control:input”, channel=“exec:command:steckdoseG2-status:output”, autoupdate=“true” }
//Alexa Switches
Switch stehlampe “Stehlampe” [ “Switchable”] { channel=“exec:command:steckdoseG2-control:input”, channel=“exec:command:steckdoseG2-status:output”, autoupdate=“true” }
.things
//SteckdoseG2
Thing exec:command:steckdoseG2-control [ command=“sudo /scripts/steckdose2.sh %2$s”, interval=0, autorun=true ]
Thing exec:command:steckdoseG2-status [ command=“sudo /scripts/steckdose2.sh status”, interval=0, timeout=5 ]
alexa.rules
//Stehlampe
rule "Stehlampe on"
when
Item stehlampe received command ON
then
sendCommand(steckdoseG2Switch,“ON”)
end
rule "Stehlampe off"
when
Item stehlampe received command OFF
then
sendCommand(steckdoseG2Switch,“OFF”)
end
.sitemap
Switch item=steckdoseG2Switch mappings=[ “ON”=“ON”, “OFF”=“OFF” ]
Switch item=stehlampe
The .sh script for the powerplug is the same as above.
1 Like
myon99
(marco)
May 19, 2017, 10:47pm
9
Thx @darksoul666 this worked well for me.
1 Like