Homekit device issue

Hi Again -
Continuing saga :slight_smile:
I have now obtained a “Sonoff” plug that has been flashed with Homekit firmware - It works perfectly with the wife’s iphone (just on & off, simple! )

So… From a FRESH Install of the official build on a Pi3b+ I set up the thing on the wifi and added the “homekit” adapter on the gateway - Held my breath, and searched…

It found it OK and it up, and there is was!! The only “thing” :slight_smile:

Then I switched it “on” and the device switched on - YAY!
Then I switched it “off” and… The device stayed on and the gateway “thing” UI showed three dots and that was it …

Now I cannot “remove” the Thing" from my gateway, it just sits and looks at me when I hit “remove”… I can’t get rid of it to try again…

I DID reflash and start again ( twice now) and the same thing happens, it will change state once and then “hang”
I tried uninstalling the Homekit adapter - but the “thing” stayed on the screen.

The device also has a simple UI on port 80 with an on & an off button which send "?set=on " & “?set=off” respectively from the url and that works OK .

Where do i go from here? Should I log a bug in Github?
The log shows;

2019-12-14 10:56:17.120 INFO : Loading add-on: homekit-adapter
2019-12-14 10:56:18.163 INFO : homekit: Opening database: /home/pi/.mozilla-iot/config/db.sqlite3
2019-12-14 10:56:19.279 INFO : homekit: Loading add-on homekit-adapter from /home/pi/.mozilla-iot/addons/homekit-adapter
2019-12-14 10:56:20.956 ERROR : homekit: AddonManagerProxy: No such device: homekit-D2:EB:C9:D2:4D:98
2019-12-14 10:56:20.960 ERROR : homekit: AddonManagerProxy: Ignoring msg: { messageType: 8198,
2019-12-14 10:56:20.962 ERROR : homekit: data:
2019-12-14 10:56:20.963 ERROR : homekit: { deviceId: ‘homekit-D2:EB:C9:D2:4D:98’,
2019-12-14 10:56:20.964 ERROR : homekit: propertyName: ‘1-10’,
2019-12-14 10:56:20.966 ERROR : homekit: propertyValue: false,
2019-12-14 10:56:20.967 ERROR : homekit: adapterId: ‘homekit-adapter’,
2019-12-14 10:56:20.968 ERROR : homekit: pluginId: ‘homekit-adapter’ } }
2019-12-14 10:56:20.977 ERROR : homekit: AddonManagerProxy: No such device: homekit-D2:EB:C9:D2:4D:98
2019-12-14 10:56:20.979 ERROR : homekit: AddonManagerProxy: Ignoring msg: { messageType: 8198,
2019-12-14 10:56:20.980 ERROR : homekit: data:
2019-12-14 10:56:20.982 ERROR : homekit: { deviceId: ‘homekit-D2:EB:C9:D2:4D:98’,
2019-12-14 10:56:20.983 ERROR : homekit: propertyName: ‘1-10’,
2019-12-14 10:56:20.985 ERROR : homekit: propertyValue: false,
2019-12-14 10:56:20.986 ERROR : homekit: adapterId: ‘homekit-adapter’,
2019-12-14 10:56:20.988 ERROR : homekit: pluginId: ‘homekit-adapter’ } }
2019-12-14 10:56:21.517 INFO : homekit: Found IP device: { name: ‘Sonoff Switch-3DE13B’,
2019-12-14 10:56:21.519 INFO : homekit: address: ‘192.168.1.113’,
2019-12-14 10:56:21.521 INFO : homekit: port: 5556,
2019-12-14 10:56:21.523 INFO : homekit: ‘c#’: 1,
2019-12-14 10:56:21.524 INFO : homekit: ff: 0,
2019-12-14 10:56:21.526 INFO : homekit: id: ‘D2:EB:C9:D2:4D:98’,
2019-12-14 10:56:21.528 INFO : homekit: md: ‘Basic’,
2019-12-14 10:56:21.530 INFO : homekit: pv: ‘1.0’,
2019-12-14 10:56:21.531 INFO : homekit: ‘s#’: 1,
2019-12-14 10:56:21.533 INFO : homekit: sf: 0,
2019-12-14 10:56:21.535 INFO : homekit: ci: 8 }

an update on this…
Rebooting the GW seems to read the correct state of the switch AND it works correctly once… As in the state of the physical switch changes and the state of the switch in the UI reflects that… the second attempt to change the state of the switch fails to both change the physical switch and gives the “three dots” in the UI …

Can you send me a full log, please? mstegeman@mozilla.com

I’m wondering if the add-on is crashing or something.

OK :slight_smile:

I will send it soon

@mstegeman - I PM’d you the “run log” I hope that is the log you want …
Oh Just FYI … I have one other “thing” - a virtual switch called “virtual switch” - The Homekit thing is called “light” .
You can see an error there where I used the Mycroft API to to try to switch on “lightS” :slight_smile:

Mycroft is working to switch the “virtual Switch”

@mstegeman
You know, the more I think about this the more I start to think that his is some sort of a database or permissions issue.

Database permissions would also account for the fact that it is impossible to remove the “thing” …
(EDIT) - Note - I CAN remove the “thing” only after a reboot , after the first use of the “thing” the “remove” button does nothing .

Looking at the log, when the, the gateways starts up, it loads all the information about the homekit device into somewhere e.g
2019-12-15 08:41:45.864 INFO : homekit: [Device D2:EB:C9:D2:4D:98] Found characteristic: public.hap.characteristic.on
2019-12-15 08:41:45.865 INFO : homekit: {
2019-12-15 08:41:45.866 INFO : homekit: “aid”: 1,
2019-12-15 08:41:45.868 INFO : homekit: “iid”: 10,
2019-12-15 08:41:45.869 INFO : homekit: “type”: “25”,
2019-12-15 08:41:45.870 INFO : homekit: “perms”: [
2019-12-15 08:41:45.872 INFO : homekit: “pr”,
2019-12-15 08:41:45.873 INFO : homekit: “pw”,
2019-12-15 08:41:45.874 INFO : homekit: “ev”
2019-12-15 08:41:45.876 INFO : homekit: ],
2019-12-15 08:41:45.877 INFO : homekit: “ev”: false,
2019-12-15 08:41:45.878 INFO : homekit: “description”: “On”,
2019-12-15 08:41:45.880 INFO : homekit: “format”: “bool”,
2019-12-15 08:41:45.881 INFO : homekit: “value”: true
2019-12-15 08:41:45.883 INFO : homekit: }

Then it is all ready, and then the first time the switch is used, it works, and the state of the switch is updated in the UI etc… But I wonder of this data is then not updated in the database?
The next time it goes to use the switch, basically it seems that it can’t find/read/something the data and so (eventually) times out -
The reason I say this, is because I never need to do anything with the switch itself, just reboot the gateway, and then it works again - even if the switch itself is failing to respond to some sort of a status check after the initial state change, so therefore the database is not updated (or whatever) , then maybe after a short time out the state should be inferred?

Of course all of this is speculation :slight_smile: I don’t know if there are logs for the actual adapter itself…

just for the record, disabling and/or reinstalling the homekit adapter does not make it work again, only a reboot of the gateway does that :frowning:

I don’t see anything obvious in the log, so my guess is that the firmware doesn’t conform to the HAP (HomeKit Accessory Protocol) spec properly. I wish I had a better answer for you!

We do have adapters now for both Tasmota and ESPHome, if you’re interested in trying those out.

Oh, I just noticed something else. In your original post, you said the device works well with your wife’s phone. However, HomeKit devices are only meant to be “paired” with a single controller, which means it needs to be paired with either your wife’s phone or the gateway.

I meant that it worked OK with her Iphone BEFORE I “unpaired” it :slight_smile:
I have reset it and gone though lots of stuff a few time since then…
It is a shame that it just works once , I am getting sick of rebooting the gateway … So close & yet so far!

I didn’t flash the Sonoff - I bought it off Ebay flashed…, I have been looking for a CHEAP way of testing a couple of plugs, so far I have spent more that I wanted to to begin with … I don’t think I want to “play” with reflashing it …

The annoying part is that the local UK “Alexa & Google home” compatible plugs are cheap here , and homekit etc. are easily 4 times the price - A Zigbee dongle (£40 ) then leads into the expensive zigbee plugs that are almost as expensive as the Homekit ones…

Basically it seems that it isn't worth the money - I am not interested really in "Automating" anything, just seeing how the IOT can be used without relying upon "Clown" services and corporate spying :(

Sad, but I think the corporations have a strangle hold, especially when there is no Regulation or proper “standard” for these devices…
</rant mode>

Thanks, I will keep playing but I think i am at a dead end at the moment.

Ohh - all the above said…
IF I did get the stuff together to flash it (You know I won’t be able to rest till I something working LOL!) , would you recommend ESP or Tasmota?
:slight_smile:

I think that’s up to personal preference, as the two have different feature sets. Maybe @t1m1 could weigh in?

You might also want to check out this thread.

1 Like

Thanks so much @mstegeman for your patience… I have learnt a LOT in the last few days… I have managed to flash my cheap Koogeek UK version ( KLUP1) with Tasmota (OTA - which was fun and involved accidentally destroying an SD card while flashing rasbian stretch for the pi that normally runs the gateway so I could use it for Tuya-convert… etc… etc… etc… )

And thanks to @t1m1 's new Tasmota Adaptor , a bit of swearing it all works… AND It can control it by voice from Mycroft (which was my original project!)

How can the KLUP1 now be added with a proviso that it be flashed with Tasmota to the Wiki?
https://blakadder.github.io/templates/kogeek_KLUP1.html

That’s great! I’m glad you have something working now.

The Supported Hardware page on our wiki is user-editable, so feel free to add it in whatever way seems best.

1 Like

had a hack at the wiki :slight_smile: