indigodomo / HomeKit-Bridge

Enabled HomeKit integration via Homebridge for Indigo Home Automation
The Unlicense
46 stars 13 forks source link

Turning Virtual Devices on/off does not work. #117

Open ryanlm opened 5 years ago

ryanlm commented 5 years ago

I am trying to get a Insteon Keypad's buttons to work. In short, I created virtual on/off devices and used triggers in Indigo to set the state. However, when mapping the virtual on/off device to a HomeBridge switch, it only works one way via the Home app on iOS. It does update correctly when using the physical switch/keypad.

Expected Behavior

Clicking the virtual device presented as a switch, tapping it should turn it on, and tapping it again should turn it off.

Current Behavior

The state never changes in Indigo of the virtual device. The logs show either the ON request coming in or the OFF request coming in, but not each. Stated another way, if I create one virtual device it will only see ON requests from the Home App. If I create another one it may only see OFF requests. Seems random.

Steps to Reproduce (for bugs)

  1. Create a virtual on/off device.
  2. Map it via HomeKit Bridge in Indigo as a switch.
  3. Tap its button in the Home App, the state should not change in Indigo.

Versions

v1.0.2 released on July 18, 2018 Fresh install of this plugin and

Configuration


   HomeKit Bridge                  {
        "platforms": [
                {
                        "protocol": "http", 
                        "name": "HomeKit Bridge Server", 
                        "listenPort": "8445", 
                        "platform": "Indigo2", 
                        "host": "127.0.0.1", 
                        "debug": false, 
                        "serverId": 637357676, 
                        "port": "8558"
                }
        ], 
        "bridge": {
                "username": "CC:22:3D:E3:CE:10", 
                "name": "Indigo HomeKit Bridge", 
                "pin": "031-45-154", 
                "port": "51826"
        }, 
        "accessories": [], 
        "description": "HomeKit configuration generated by HomeKit Bridge on 2018-09-22 13:59:00.934000 for device Indigo HomeKit Bridge"
}

Homebridge Log / Command Output

[2018-9-22 13:59:02] Homebridge is running on port 51826.
[2018-9-22 13:59:04] [HomeKit Bridge Server] Test Switch: get(On) => false
[2018-9-22 13:59:10] [HomeKit Bridge Server] Test Switch: set(On) false -> true
[2018-9-22 13:59:10] [HomeKit Bridge Server] HomeKit Bridge request: http://127.0.0.1:8558/HomeKit?objId=280738476&serverId=637357676&jkey=06d7af5627e0f5eb0fe22d6af633dd1e80c390c3439bd35ffb600b90bc8bc11c&cmd=setCharacteristic&On=true
[2018-9-22 13:59:10] [HomeKit Bridge Server] Test Switch: updateCharacteristicValue(On): true -> false
[2018-9-22 13:59:18] [HomeKit Bridge Server] Test Switch: set(On) false -> true
[2018-9-22 13:59:18] [HomeKit Bridge Server] HomeKit Bridge request: http://127.0.0.1:8558/HomeKit?objId=280738476&serverId=637357676&jkey=06d7af5627e0f5eb0fe22d6af633dd1e80c390c3439bd35ffb600b90bc8bc11c&cmd=setCharacteristic&On=true
[2018-9-22 13:59:18] [HomeKit Bridge Server] Test Switch: updateCharacteristicValue(On): true -> false
[2018-9-22 13:59:23] [HomeKit Bridge Server] Test Switch: set(On) false -> true
[2018-9-22 13:59:23] [HomeKit Bridge Server] HomeKit Bridge request: http://127.0.0.1:8558/HomeKit?objId=280738476&serverId=637357676&jkey=06d7af5627e0f5eb0fe22d6af633dd1e80c390c3439bd35ffb600b90bc8bc11c&cmd=setCharacteristic&On=true
[2018-9-22 13:59:23] [HomeKit Bridge Server] Test Switch: updateCharacteristicValue(On): true -> false
[2018-9-22 13:59:31] [HomeKit Bridge Server] Test Switch: set(On) false -> true
[2018-9-22 13:59:31] [HomeKit Bridge Server] HomeKit Bridge request: http://127.0.0.1:8558/HomeKit?objId=280738476&serverId=637357676&jkey=06d7af5627e0f5eb0fe22d6af633dd1e80c390c3439bd35ffb600b90bc8bc11c&cmd=setCharacteristic&On=true
[2018-9-22 13:59:31] [HomeKit Bridge Server] Test Switch: updateCharacteristicValue(On): true -> false
[2018-9-22 13:59:33] [HomeKit Bridge Server] Virtual Keypad Button: get(On) => true
[2018-9-22 13:59:36] [HomeKit Bridge Server] Virtual Keypad Button: set(On) true -> false
[2018-9-22 13:59:36] [HomeKit Bridge Server] HomeKit Bridge request: http://127.0.0.1:8558/HomeKit?objId=1736185922&serverId=637357676&jkey=b26972baa0f89b62c31e6e12a10669486e26ce322971462094e343f3b9fde8b5&cmd=setCharacteristic&On=false
[2018-9-22 13:59:36] [HomeKit Bridge Server] Virtual Keypad Button: updateCharacteristicValue(On): false -> true
[2018-9-22 14:09:43] [HomeKit Bridge Server] Garage Entryway Keypad: get(On) => true
[2018-9-22 14:09:43] [HomeKit Bridge Server] Test Switch: get(On) => false
[2018-9-22 14:09:43] [HomeKit Bridge Server] Virtual Keypad Button: get(On) => true

Device Simulation Report


    Service : 
        alias : Test Switch
        model : 
        subModel : 
        indigoType : indigo.RelayDevice
        pluginType : indigo.RelayDevice.com.perceptiveautomation.indigoplugin.devicecollection.pseudoRelay
        type : Switch
        desc : Switch
        objId : 280738476
        serverId : 637357676
        invertOnState : False
        convertFahrenheit : False
        required : (List)
            On : False
        optional : (List)
        native : True
        requiresPlugin : (List)
        actions : (List)
            Action : (HomeKitAction)
                Characteristic : On
                When : equal
                Value : False (bool)
                Value2 : 0 (bool)
                Command : device.turnOff
                Arguments : [280738476]
                monitors : {280738476: 'attr_onState'}
            Action : (HomeKitAction)
                Characteristic : On
                When : equal
                Value : True (bool)
                Value2 : 0 (bool)
                Command : device.turnOn
                Arguments : [280738476]
                monitors : {280738476: 'attr_onState'}
        loadOptional : False
        characterDict : (Dict)
            On : False
Colorado4Wheeler commented 5 years ago

Hmmm, I have a dozen virtual on/off devices working in HomeKit via HKB and your device simulation shows that it is correctly detecting the state. The logs also look correct. Can you verify that using the Indigo UI will properly turn on and off the device AND (the AND is critical here) that you can see the device state change in Indigo AND (yup, again) that the variable you assigned to the virtual group as the device state is changing each time?