brutella / hap

The HomeKit Accessory Protocol (hap) implemented in Go
Apache License 2.0
346 stars 39 forks source link

Actions connected to ProgrammableSwitchEvent not working #27

Closed nicolov closed 1 year ago

nicolov commented 1 year ago

Thank you for the great work!

I'm building a simple MQTT -> HomeKit bridge using this library. I created a StatelessProgrammableSwitch accessory to expose a pushbutton:

acc := accessory.New(accessory.Info{
    Name: "hello",
}, accessory.TypeProgrammableSwitch)
s := service.NewStatelessProgrammableSwitch()
acc.AddS(s.S)

I can send events on this switch with the following:

s.ProgrammableSwitchEvent.SetValue(characteristic.ProgrammableSwitchEventSinglePress)

This seems to work: the home app highlights the "single press" menu item when I press the button.

However, actions connected to the button press are not working (ie nothing happens).

Is there any missing piece that allows homekit to trigger actions based on the change of characteristic?

nicolov commented 1 year ago

It turns out that the problem was that my Apple TV was offline. Thank you again!