Hi,
I was able to use this amazing platform to integrate my gadgets with HomeKit, but I think I discovered a bug. Before posting I have upgraded to latest snapshot.
Status: I’m able to set particular illumination level using HomeKit manually.
Bug: When I create a scene in HomeKit mobile app with one light which should be set to 20% illumination and click test scene, it works as expected and the light is set to 20%.
OH2 log when scene is tested in HomeKit app:
12:13:45.044 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'Dimmer' received command ON
12:13:45.047 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'Dimmer' received command 20
12:13:45.047 [INFO ] [marthome.event.ItemStateChangedEvent] - Dimmer changed from 0 to 100
12:13:45.051 [INFO ] [marthome.event.ItemStateChangedEvent] - Dimmer changed from 100 to 20
But when the scene is saved and then activated, the light is set to 100% after activation.
OH2 log when a the scene is activated in HomeKit app:
12:12:47.256 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'Dimmer' received command 20
12:12:47.258 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'Dimmer' received command ON
12:12:47.258 [INFO ] [marthome.event.ItemStateChangedEvent] - Dimmer changed from 0 to 20
12:12:47.261 [INFO ] [marthome.event.ItemStateChangedEvent] - Dimmer changed from 20 to 100
I installed latest snapshot yesterday. Everything works fine.
You have to create rule for you lighting item. See example -
rule:
rule "Populate lr_Light from zwave_device_1590aeb5569_node6_switch_dimmer"
when
Item zwave_device_1590aeb5569_node6_switch_dimmer received update or
System started
then
lr_Light.postUpdate(zwave_device_1590aeb5569_node6_switch_dimmer.state)
end
rule "lr_Light switched"
when
Item lr_Light received command
then
if (receivedCommand != ON) {
zwave_device_1590aeb5569_node6_switch_dimmer.sendCommand(receivedCommand)
}
end
Thanks for the reply. As I understand you have an item added in Paper UI as “zwave_device_1590aeb5569_node6_switch_dimmer” and you have created “lr_Light” in text file .items and using this rule you are reflecting changes between them.
In my case, I just have added Z-Wave Dimmer item in Paper UI and tagged it with “Lighting”.
Now, after a couple of restarts, when using scene, the behavior is OK. But when I say “Hey Siri, set bedroom light to 20%” is set to 100% and log looks as follows:
14:56:58.242 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'Nocni_Lampa_Matus_Dimmer' received command 20
14:56:58.243 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'Nocni_Lampa_Matus_Dimmer' received command ON
14:56:58.246 [INFO ] [marthome.event.ItemStateChangedEvent] - Nocni_Lampa_Matus_Dimmer changed from 0 to 20
14:56:58.249 [INFO ] [marthome.event.ItemStateChangedEvent] - Nocni_Lampa_Matus_Dimmer changed from 20 to 100
Maybe I missed something in documentation, and I need to create a duplicate of each Z-Wave item dimmer and reflect changes between them, but it seems like double work.
Thanks, I have used your rule and it works perfectly.
This is related only to items defined outside .items file?
Or do I need to have duplicates e.g. for thermostat .items (I think there are 3 of them) and make a sync rule also for them? Asking because as now, when I change the heating/cooling mode in OH2 is then instantly projected into HomeKit app, but not vice versa.
To operate the thermostat I’m using thermostat rule. Now it’s operating only heating and it’s semi-prepared also for cooling:
ule "Thermostat"
when
Item Switch_HeatingMode changed or
Item Setpoint_TargetTemp changed or
Item Number_ActualTemp changed
then
if (Switch_HeatingMode.state == "Off") {
// heater&cooler off
Switch_HeatingRelay.sendCommand(OFF)
//insert truning off cooler here
} else if (Switch_HeatingMode.state == "HeatOn") {
// heater on, cooler off
Switch_HeatingRelay.sendCommand(ON)
//insert truning off cooler here
} else if (Switch_HeatingMode.state == "CoolOn") {
// cooler on
//insert turning on cooler here
} else if (Switch_HeatingMode.state == "Auto") {
// get the current setpoint for the room
var Number setpoint = Setpoint_TargetTemp.state as DecimalType
// calculate the turn on/off temperatures
var Number turnOnTemp = setpoint - 0.4
var Number turnOffTemp = setpoint + 0.3
// get the current temperature in the room
var Number temp = Number_ActualTemp.state as DecimalType
// determine whether we need to turn on/off the heater
if (temp <= turnOnTemp) {
// turn on temp has been reached so switch on the heater
Switch_HeatingRelay.sendCommand(ON)
} else if (temp >= turnOffTemp) {
// turn off temp has been reached so switch off the heater
Switch_HeatingRelay.sendCommand(OFF)
}
}
end
I thought that when I change the heating mode in HomeKit app ti will update item Switch_HeatingMode, but it doesn’t. Not sure how to catch this change and update this item. It works when I change the heating mode in OH2 UI it’s instantly changed in HomeKit app. I have no troubles with populating the target temperature change from HomeKit app to Setpoint_TargetTemp item.