Homekit - Could not find existing MAC

Tags: #<Tag:0x00007f616f62f1b0>

Hi,
I am having some issues with the Homekit binding on OH V2.5.5 Release.

This binding has been working fine for many months. I don’t think I changed anything, but cleared the cache as part of resolving an issue with the Alexa Control binding (now resolved).

I have read and tried everything I can about this issue. I am stuck.
When OH starts up I get a message

[WARN ] [homekit.internal.HomekitAuthInfoImpl] - Could not find existing MAC in org.eclipse.smarthome.storage.json.internal.JsonStorage. Generating new MAC. This will require re-pairing of iOS devices.

When OH shutsdown I get a message for each tagged item…
[WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitSwitchImpl@14b1285 but bridge is null

I have:
Removed the binding
Cleared Pairings
Restarted OH (about 1000 times)
Cleared OH cache
Removed the Home in IOS
Deleted the homekit.json file and the backups
removed the homekit.config file
None has had any effect.

Looking that the homekit.json file, it looks fine and does have a MAC entry.

The result is that the homekit interface works until the next restart of OH when the devices all show offline in the Home app.

I would really appreciate any suggestions as I’m really stuck.

Thanks

Hi Gavin,
just to confirm my understanding: homekit works fine as expected until restart, after an restart it cannot find the mac address in homekit.json and you need to re-pair (add home in home app, etc), right?

please check:

  • you have only one version of homekit binding running. you can do it in karaf using this command
    list | grep Homekit
  • make sure openhab user can write homekit.json.
    is there anything inside of the homekit.json or is it empty?

Hi eugen and many thanks for your help.
Yes, homekit works as expected until a restart (with some items missing - I have 61 items tagged for homekit control, but only 41 of those are visible for some reason. While trying to resolve this current issue, I did change over to use the new method {homekit=“Lighting”}).

After a OH restart the logs show the following warning

[WARN ] [homekit.internal.HomekitAuthInfoImpl] - Could not find existing MAC in org.eclipse.smarthome.storage.json.internal.JsonStorage. Generating new MAC. This will require re-pairing of iOS devices.

Only one version of the binding is running.
openhab> list | grep Homekit
271 x Active x 80 x 2.5.5 x openHAB Add-ons :: Bundles :: IO :: Homekit

The file homekit.json is writable by openhab (as it creates it when I delete it) and does contain an entry …

“mac”: {
“class”: “java.lang.String”,
“value”: “ee:e6:43:da:81:f5”
},

After an OH restart all homekit parings are lost until I remove the home and start again.

I also get the following [Warning] at restart

2020-06-18 10:50:59.913 [WARN ] [org.eclipse.jetty.server.HttpChannel] - /rest/items

javax.servlet.ServletException: javax.servlet.ServletException: A MultiException has 1 exceptions. They are:

  1. java.lang.IllegalStateException: ServiceLocatorImpl(__HK2_Generated_0,1,28350694) has been shut down

    at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:88) ~[bundleFile:?]

    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.Server.handle(Server.java:494) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:374) [bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:268) [bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) [bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) [bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) [bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) [bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) [bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) [bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:367) [bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:782) [bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:918) [bundleFile:9.4.20.v20190813]

    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]

Caused by: javax.servlet.ServletException: A MultiException has 1 exceptions. They are:

  1. java.lang.IllegalStateException: ServiceLocatorImpl(__HK2_Generated_0,1,28350694) has been shut down

    at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:489) ~[?:?]

    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427) ~[?:?]

    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388) ~[?:?]

    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341) ~[?:?]

    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228) ~[?:?]

    at com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76) ~[?:?]

    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:852) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:544) ~[bundleFile:9.4.20.v20190813]

    at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) ~[bundleFile:?]

    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:536) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1581) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1307) ~[bundleFile:9.4.20.v20190813]

    at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:293) ~[bundleFile:?]

    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:482) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1549) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1204) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[bundleFile:9.4.20.v20190813]

    at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) ~[bundleFile:?]

    … 15 more

Caused by: org.glassfish.hk2.api.MultiException: A MultiException has 1 exceptions. They are:

  1. java.lang.IllegalStateException: ServiceLocatorImpl(__HK2_Generated_0,1,28350694) has been shut down

    at org.jvnet.hk2.internal.FactoryCreator.getFactoryHandle(FactoryCreator.java:106) ~[?:?]

    at org.jvnet.hk2.internal.FactoryCreator.dispose(FactoryCreator.java:173) ~[?:?]

    at org.jvnet.hk2.internal.SystemDescriptor.dispose(SystemDescriptor.java:526) ~[?:?]

    at org.glassfish.jersey.process.internal.RequestScope$Instance.remove(RequestScope.java:532) ~[?:?]

    at org.glassfish.jersey.process.internal.RequestScope$Instance.release(RequestScope.java:549) ~[?:?]

    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:319) ~[?:?]

    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) ~[?:?]

    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) ~[?:?]

    at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473) ~[?:?]

    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427) ~[?:?]

    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388) ~[?:?]

    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341) ~[?:?]

    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228) ~[?:?]

    at com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76) ~[?:?]

    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:852) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:544) ~[bundleFile:9.4.20.v20190813]

    at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) ~[bundleFile:?]

    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:536) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1581) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1307) ~[bundleFile:9.4.20.v20190813]

    at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:293) ~[bundleFile:?]

    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:482) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1549) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1204) ~[bundleFile:9.4.20.v20190813]

    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[bundleFile:9.4.20.v20190813]

    at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) ~[bundleFile:?]

    … 15 more

Caused by: java.lang.IllegalStateException: ServiceLocatorImpl(__HK2_Generated_0,1,28350694) has been shut down

at org.jvnet.hk2.internal.ServiceLocatorImpl.checkState(ServiceLocatorImpl.java:2288) ~[?:?]

at org.jvnet.hk2.internal.ServiceLocatorImpl.getServiceHandleImpl(ServiceLocatorImpl.java:629) ~[?:?]

at org.jvnet.hk2.internal.ServiceLocatorImpl.getServiceHandle(ServiceLocatorImpl.java:622) ~[?:?]

at org.jvnet.hk2.internal.ServiceLocatorImpl.getServiceHandle(ServiceLocatorImpl.java:640) ~[?:?]

at org.jvnet.hk2.internal.FactoryCreator.getFactoryHandle(FactoryCreator.java:103) ~[?:?]

at org.jvnet.hk2.internal.FactoryCreator.dispose(FactoryCreator.java:173) ~[?:?]

at org.jvnet.hk2.internal.SystemDescriptor.dispose(SystemDescriptor.java:526) ~[?:?]

at org.glassfish.jersey.process.internal.RequestScope$Instance.remove(RequestScope.java:532) ~[?:?]

at org.glassfish.jersey.process.internal.RequestScope$Instance.release(RequestScope.java:549) ~[?:?]

at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:319) ~[?:?]

at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) ~[?:?]

at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) ~[?:?]

at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473) ~[?:?]

at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427) ~[?:?]

at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388) ~[?:?]

at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341) ~[?:?]

at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228) ~[?:?]

at com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76) ~[?:?]

at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:852) ~[bundleFile:9.4.20.v20190813]

at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:544) ~[bundleFile:9.4.20.v20190813]

at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) ~[bundleFile:?]

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[bundleFile:9.4.20.v20190813]

at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:536) ~[bundleFile:9.4.20.v20190813]

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.20.v20190813]

at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[bundleFile:9.4.20.v20190813]

at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1581) ~[bundleFile:9.4.20.v20190813]

at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[bundleFile:9.4.20.v20190813]

at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1307) ~[bundleFile:9.4.20.v20190813]

at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:293) ~[bundleFile:?]

at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[bundleFile:9.4.20.v20190813]

at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:482) ~[bundleFile:9.4.20.v20190813]

at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1549) ~[bundleFile:9.4.20.v20190813]

at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[bundleFile:9.4.20.v20190813]

at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1204) ~[bundleFile:9.4.20.v20190813]

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[bundleFile:9.4.20.v20190813]

at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) ~[bundleFile:?]

... 15 more

Thanks again for your help

More info discovered…

When I stop the OH service, the file homekit.json gets re-written and the MAC entry is removed.

To clarify:
If I look at homekit.json when OH is running - there IS an entry for mac:
But if I stop the OH service then look at homekit.json the only entry is the “revision”, there is no mac: entry.

This (I guess ) explains why a new mac is generated at every startup!

To prove that the destruction of homekit.json at OH shutdown is the issue, I temporarily made it read-only to OH (when OH was running). I still see the messages at shutdown …

[WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitSwitchImpl@831cdb but bridge is null

But on restart I do not get the message about the missing mac AND the paring stays intact and homekit works.
I realise that this is not a solution - but it may help discover the under lying issue.

There is a thread somewhere which suggests to clear pairings and restart twice. I can’t remember the exact steps off the top of my head. I was having a problem with the MAC address being forgotten and it helped me.

Gavin, thank you for the detailed analysis! We had reports about this issue in the past but could never find out the reason and fix it. maybe we will do it with your help.

i checked the source code and there is no place with “remove mac”. it has actually only 2 lines dealing with mac in the complete binding source code

  • get mac from homekit.json
  • generate new mac and store it

there is nothing like “remove mac” or “clear mac”.

second observation from code.
“trying to remove … but bridge is null” happens only if openhab informs homekit about changes in the items configuration. it should not get execute on binding stop or start. only on items config change.

could you please do one more test:

  • start openhab with homekit binding
  • check revision number in homekit.json
  • changes something in items config (e.g. remove one line or add one line)
  • wait for 20 seconds or so
  • check revision number in homekit.json. it should get increased
  • shutdown openhab and check revision number one more time

Hay eugen,

I gave OH back RW access to the homekit.json file
With OH running the revision was “5”.

I changed an item and saw in the log that the item file was refreshed. The revision remained at “5”.

I then tried to shutdown OH - it crashed (and I’m guessing did not run the shutdown routines)

With OH down, I checked homekit.json and it was the same - revision “5”

I started OH and did not get the “Could not find existing MAC in” message in the log - it started ok and Homekit works.

I changed an items file again and again checked homekit.json - revision is still “5”

I then stopped the OH service and got 39 messages …
2020-06-18 21:34:23.746 [WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitSwitchImpl@19d41de but bridge is null

With OH stopped the revision is now “6” but now the mac entry is still there - this is strange as in previous testing, after stopping OH the homekit.json file only contained a revision entry.

I am now going to clearPairings/remove the binding/clear cache and try to reproduce this behaviour.

I will report back.

So, next tests to try and reproduce the same behaviour.
I should say that OH has been stable and has had zero issues for quite a few months before this issue.

  • I removed the homekit binding, deleted homekit.json and all backups. Cleared the OH cache then restarted the OH service twice. The second time OH started with a clean log - no errors and no warnings.
  • I then installed the homekit binding and got the warning “Could not find existing MAC” - I guess this is expected.
  • At this point the homekit.json file has a mac entry, but no revision.
  • I changed an item, waited 20 seconds and checked homekit.json - now the file ONLY has a revision entry “2” - the mac and other entries are gone.
  • I restart the service and get the log entry “Could not find existing MAC”. The json file now has all expected entries and revision “3”. Lots of exception warnings in the log during restart (unlike the clean start when homekit was not installed).

The other odd thing is that i get a log entry …
2020-06-18 22:08:39.896 [INFO ] [mekit.internal.HomekitChangeListener] - Created 38 HomeKit items.
When I search for “homekit=” across all items files it get a total of 62 - this is the expected number of homekit enabled items. I think (but am not sure) that all items that are missing are homekit=“Lighting”. The ones that are there are homekit=“Switchable” and temperature.

Please just let me know if I can provide any other info.
I really appreciate your help - this one has me stuck.

@rrgeorge you did an investigation on this issue last time (3 years ago)

do you remember what was the root cause for this issue?
looking on homekit binding code i cannot find anything that would result in deleting mac address from homekit.json and anything i can do to ensure that mac address is stored. i cannot flush storage, i can only do "storage.put(“mac”, …).

Wow. You’re really trying to revive this binding. :laughing:

I think the problem was that the new MAC wasn’t being stored till you shutdown the binding, and if you paired with iOS, then it didn’t get stored for some reason.

If by “stored” you mean written to homekit.json, then I am not sure that this is correct.
After OH starts I can see the MAC entry in the JSON file. After OH stops it is gone. It is being removed when OH shuts down (I think at the same time as it generates the log entry …

[WARN ] [it.internal.HomekitAccessoryRegistry] - trying to remove org.openhab.io.homekit.internal.accessories.HomekitSwitchImpl@12b6389 but bridge is null

BTW - I have removed all items files except 1 to confirm that it is not being caused by an error in an items file … it is not. After doing this and putting all items files back, I get these two log entries …

2020-06-19 10:53:30.567 [INFO ] [mekit.internal.HomekitChangeListener] - Created 0 HomeKit items.

2020-06-19 10:53:30.578 [WARN ] [homekit.internal.HomekitAuthInfoImpl] - Could not find existing MAC in org.eclipse.smarthome.storage.json.internal.JsonStorage. Generating new MAC. This will require re-pairing of iOS devices.

So not I have zero homekit items (no changes to items files, just removed and readded them).

If I remember correctly, there’s a more permenant store in the java cache that it creates the homekit.json from.

Java preferences (java.util.Preferences), not cache.

it is all pretty strange. can you share your item configuration - just few examples which are not working.

btw, in karaf you can check homekit accessories with
homekit:list

openhab> smarthome:homekit listAccessories
523133216 Air Conditioner High
2135578493 Bedroom Fan Power
63456321 Air Conditioner
325175901 Drinks Fridge
345729927 Fence Unit
1617624282 Laser Printer
1415582307 Gavins Workstation
2011523614 Garage Display
1707441023 Tablet Weather
995698941 Dexters Door
147694675 AirCon Master
595972165 Away Mode
1666435640 Coolroom
1236620193 Dishwasher
72359997 Pond Pump
1967127131 Air Conditioning
1228445719 Bathroom Fan
1967127130 Air Con
1683166461 Outside Lights
995698940 Hobsons Door
358611059 Air Conditioner Medium
640342911 Air Conditioner Low
1324680971 Tablet Screen
2005209109 Livingroom Fan Power
946044987 Garage Door
1486063088 TV
2011288448 Catbed
1347040216 ALL Lights
1796641134 Can Crusher
985637253 Office Fan
1180901637 Plant Mist
744321183 Garage Lights
1248978364 Guest Room Fan
472362949 Aux Charger
473520579 Green Room LED Color
1876784414 Bug Zapper
675285741 Tracys Workstation
168669480 Greenroom Lights
2143150586 Alarm System
143441191 Generator
openhab>


Here are two items - the light is not working, the fan is working

//=========================================================================================================================

// Office Light

Switch Office_Light "Office Light [%s]" <light> (gOffice, gLights, gSleep, gAway,gPowerSave) 

        { channel="mqtt:topic:pi1_mqtt:Office_Light:Office_Light" , alexa="Lighting", homekit="Lighting"}

Number Office_Light_RSSI "Office Light RSSI [%d%%]" <network> 

        { channel="mqtt:topic:pi1_mqtt:Office_Light:Office_Light_RSSI" }

Number Office_Light_STA "Office Light State Age [JS(t_mins.js):%s]" <time>

        { channel="mqtt:topic:pi1_mqtt:Office_Light:Office_Light_STA" }

String Office_Light_CMD "Office_Light_CMD[%s]" 

        { channel="mqtt:topic:pi1_mqtt:Office_Light:Office_Light_CMD" }

String Office_Light_STATE "Office Light MQTT State [%s]" <switch> (gMapDBpersist,gDeviceOffline,gMQTT_Monitor)   

        { channel="mqtt:topic:pi1_mqtt:Office_Light:Office_Light_STATE" }

//=========================================================================================================================

// Office Fan

Switch Office_Fan "Office Fan [%s]" <fan_ceiling> (gOffice, gSleep, gAway,gPowerSave) 

        { channel="mqtt:topic:pi1_mqtt:Office_Fan:Office_Fan"  , alexa="Switchable" , homekit="Switchable"}

Number Office_Fan_RSSI "Office_Fan RSSI [%d%%]" <network> 

        { channel="mqtt:topic:pi1_mqtt:Office_Fan:Office_Fan_RSSI" }

Number Office_Fan_STA "Office_Fan State Age [JS(t_mins.js):%s]" <time>

        { channel="mqtt:topic:pi1_mqtt:Office_Fan:Office_Fan_STA" }

String Office_Fan_CMD "Office_Fan_CMD[%s]" 

        { channel="mqtt:topic:pi1_mqtt:Office_Fan:Office_Fan_CMD" }

String Office_Fan_STATE "Office Fan MQTT State [%s]" <switch> (gMapDBpersist,gDeviceOffline,gMQTT_Monitor)   

        { channel="mqtt:topic:pi1_mqtt:Office_Fan:Office_Fan_STATE" }

Interestingly, no items tagged as Lighting are working - however, if I change the lighting tag to switchable - it still doesn’t work!
If I change an item that is tagged as switchable to lighting - it still works!

Edit - no items tagged as lighting are working EXCEPT group items tagged as lighting (as in all_lights).

i just copy&pasted your config without any changes i can see office light in home app
image

probably something is wrong/not supported with your group. can you give me the definition of gLights?

btw, there is a dedicated homekit accessory for the fan

i also did some changes

that maybe will fix the “mac issue”.

I don’t think I changed anything with this … but I guess I may have.

Group:Switch:OR(ON,OFF) gLights "ALL Lights [%s]"	<light>  		(gMapDBpersist)
	{alexa="Lighting", homekit="Lighting"}