Python Plugin: Homekit Insecure Client

Python and python framework

Moderator: leecollings

Post Reply
MacJL
Posts: 51
Joined: Tuesday 22 April 2014 22:17
Target OS: OS X
Domoticz version: Beta
Location: France
Contact:

Python Plugin: Homekit Insecure Client

Post by MacJL »

Hello,

For those who are interseted, I've created a python plugin to control some Homekit Devices from Domoticz. It works with Homekit Device that allow 'Insecure Mode'. For example : Homebridge and HAA.

If you want to test it, it's here :
https://github.com/macjl/Domoticz-HomekitInsecureClient

I hope this can help some installation to make Homekit and Domoticz works better together.

PS : It's not same thing as homebridge-eDomoticz (control Domoticz from Apple Home). This plugin works on the opposite way (Control Homekit device from Domoticz)
User avatar
waltervl
Posts: 5728
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: Homekit Insecure Client

Post by waltervl »

Thank you, I have added it to the Wiki Python Plugin List: https://www.domoticz.com/wiki/Plugins
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
pvdgulik
Posts: 22
Joined: Friday 28 December 2018 20:23
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Contact:

Re: Python Plugin: Homekit Insecure Client

Post by pvdgulik »

pvdgulik wrote: Sunday 25 July 2021 21:13 Thanks!! I installed it but got errors...

Code: Select all

2021-07-25 21:08:01.086 Status: Homekit: (Homekit) Started.
2021-07-25 21:08:01.086 Status: Homekit: (Homekit) Entering work loop.
2021-07-25 21:08:01.226 Status: Homekit: (Homekit) Initialized version 2.0, author 'MacJL'
2021-07-25 21:08:11.145 Error: Homekit: (Homekit) 'onMessage' failed 'JSONDecodeError'.
2021-07-25 21:08:11.146 Error: Homekit: (Homekit) ----> Line 202 in '/home/pi/domoticz/plugins/HomekitInsecureClient/plugin.py', function onMessage
2021-07-25 21:08:11.146 Error: Homekit: (Homekit) ----> Line 85 in '/home/pi/domoticz/plugins/HomekitInsecureClient/plugin.py', function onMessage
2021-07-25 21:08:11.146 Error: Homekit: (Homekit) ----> Line 348 in '/usr/lib/python3.7/json/__init__.py', function loads
2021-07-25 21:08:11.146 Error: Homekit: (Homekit) ----> Line 337 in '/usr/lib/python3.7/json/decoder.py', function decode
2021-07-25 21:08:11.146 Error: Homekit: (Homekit) ----> Line 355 in '/usr/lib/python3.7/json/decoder.py', function raw_decode
2021-07-25 21:08:21.062 Homekit: (Homekit) Connection Lost. Reconnecting.
Wrong python version?

Thanks
MacJL
Posts: 51
Joined: Tuesday 22 April 2014 22:17
Target OS: OS X
Domoticz version: Beta
Location: France
Contact:

Re: Python Plugin: Homekit Insecure Client

Post by MacJL »

Hello,

I'm not sure the problem is about the python version. It can also be a response from the Homekit Device that's not correct.
Could you provide more logs with the debug button activated?

Regards,
pvdgulik
Posts: 22
Joined: Friday 28 December 2018 20:23
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Contact:

Re: Python Plugin: Homekit Insecure Client

Post by pvdgulik »

MacJL wrote: Monday 02 August 2021 14:48 Hello,

I'm not sure the problem is about the python version. It can also be a response from the Homekit Device that's not correct.
Could you provide more logs with the debug button activated?

Regards,
Sure, hereby:

Code: Select all

2021-08-21 19:18:35.158 Status: Homekit: (Homekit) Entering work loop.
2021-08-21 19:18:35.158 Status: Homekit: (Homekit) Started.
2021-08-21 19:18:35.338 Status: Homekit: (Homekit) Initialized version 2.0, author 'MacJL'
2021-08-21 19:18:45.148 Error: Homekit: (Homekit) 'onMessage' failed 'JSONDecodeError'.
2021-08-21 19:18:45.148 Error: Homekit: (Homekit) ----> Line 202 in '/home/pi/domoticz/plugins/HomekitInsecureClient/plugin.py', function onMessage
2021-08-21 19:18:45.148 Error: Homekit: (Homekit) ----> Line 85 in '/home/pi/domoticz/plugins/HomekitInsecureClient/plugin.py', function onMessage
2021-08-21 19:18:45.148 Error: Homekit: (Homekit) ----> Line 348 in '/usr/lib/python3.7/json/__init__.py', function loads
2021-08-21 19:18:45.148 Error: Homekit: (Homekit) ----> Line 337 in '/usr/lib/python3.7/json/decoder.py', function decode
2021-08-21 19:18:45.148 Error: Homekit: (Homekit) ----> Line 355 in '/usr/lib/python3.7/json/decoder.py', function raw_decode
2021-08-21 19:19:05.121 Homekit: (Homekit) 6c 73 22 20 74 79 70 65 3d 22 6d 6f 64 75 6c 65 22 3e 3c 2f ls".type="module"></
2021-08-21 19:19:05.121 Homekit: (Homekit) 73 63 72 69 70 74 3e 3c 73 63 72 69 70 74 20 73 72 63 3d 22 script><script.src="
2021-08-21 19:19:05.121 Homekit: (Homekit) 6d 61 69 6e 2d 65 73 35 2e 66 65 39 65 35 33 63 32 32 37 38 main-es5.fe9e53c2278
2021-08-21 19:19:05.121 Homekit: (Homekit) 65 64 34 30 61 30 33 65 61 2e 6a 73 22 20 63 72 6f 73 73 6f ed40a03ea.js".crosso
2021-08-21 19:19:05.121 Homekit: (Homekit) 72 69 67 69 6e 3d 22 75 73 65 2d 63 72 65 64 65 6e 74 69 61 rigin="use-credentia
2021-08-21 19:19:05.121 Homekit: (Homekit) 6c 73 22 20 6e 6f 6d 6f 64 75 6c 65 20 64 65 66 65 72 3e 3c ls".nomodule.defer><
2021-08-21 19:19:05.121 Homekit: (Homekit) 2f 73 63 72 69 70 74 3e 0a 0a 3c 2f 62 6f 64 79 3e 3c 2f 68 /script>..</body></h
2021-08-21 19:19:05.121 Homekit: (Homekit) 74 6d 6c 3e .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. tml>
2021-08-21 19:19:05.122 Homekit: (Homekit) Pushing 'onMessageCallback' on to queue
2021-08-21 19:19:05.122 (Homekit) Processing 'onMessageCallback' message
2021-08-21 19:19:05.122 Homekit: (Homekit) Calling message handler 'onMessage'.
2021-08-21 19:19:05.122 Homekit: (Homekit) Data received
2021-08-21 19:19:05.123 Homekit: (Homekit) Local context:
2021-08-21 19:19:05.123 Homekit: (Homekit) ----> 'Devices' '{}'
2021-08-21 19:19:05.123 Homekit: (Homekit) ----> 'Domoticz' '<module 'Domoticz' (built-in)>'
2021-08-21 19:19:05.123 Homekit: (Homekit) ----> 'Images' '{}'
2021-08-21 19:19:05.123 Homekit: (Homekit) ----> 'Parameters' '{'HardwareID': 40, 'HomeFolder': '/home/pi/domoticz/plugins/HomekitInsecureClient/', 'StartupFolder': '/home/pi/domoticz/', 'UserDataFolder': '/home/pi/domoticz/', 'WebRoot': '', 'Database': '/home/pi/domoticz/domoticz.db', 'Language': 'nl', 'Version': '2.0', 'Author': 'MacJL', 'Name': 'Homekit', 'Address': '10.187.1.111', 'Port': '8080', 'SerialPort': '', 'Username': '', 'Password': '205-90-328', 'Key': 'HomekitInsecureClient', 'Mode1': '', 'Mode2': '', 'Mode3': '', 'Mode4': '', 'Mode5': '', 'Mode6': '-1', 'DomoticzVersion': '2021.1', 'DomoticzHash': '8547c5b7e', 'DomoticzBuildTime': '2021-04-17 17:29:11'}'
2021-08-21 19:19:05.124 Homekit: (Homekit) ----> 'Settings' '{'DB_Version': '148', 'LightHistoryDays': '30', 'MeterDividerEnergy': '1000', 'MeterDividerGas': '100', 'MeterDividerWater': '1000', 'RandomTimerFrame': '15', 'ElectricVoltage': '230', 'CM113DisplayType': '1', '5MinuteHistoryDays': '1', 'SensorTimeout': '60', 'SensorTimeoutNotification': '0', 'UseAutoUpdate': '1', 'UseAutoBackup': '1', 'CostEnergy': '2204', 'CostEnergyT2': '2204', 'CostGas': '7738', 'CostWater': '16473', 'UseEmailInNotifications': '0', 'SendErrorNotifications': '0', 'EmailPort': '587', 'EmailAsAttachment': '0', 'DoorbellCommand': '0', 'SmartMeterType': '0', 'EnableTabLights': '1', 'EnableTabTemp': '1', 'EnableTabWeather': '1', 'EnableTabUtility': '1', 'EnableTabCustom': '1', 'EnableTabScenes': '0', 'EnableTabFloorplans': '0', 'NotificationSensorInterval': '43200', 'NotificationSwitchInterval': '0', 'RemoteSharedPort': '6144', 'Language': 'nl', 'DashboardType': '0', 'MobileType': '0', 'WindUnit': '0', 'TempUnit': '0', 'SecStatus': '0', 'SecOnDelay': '30', 'AuthenticationMethod': '0', 'ReleaseChannel': '0', 'RaspCamParams': '-w 800 -h 600 -t 1', 'UVCParams': '-S80 -B128 -C128 -G80 -x800 -y600 -q100', 'AcceptNewHardware': '0', 'ZWavePollInterval': '60', 'ZWaveEnableDebug': '0', 'ZWaveNetworkKey': '0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10', 'ZWaveEnableNightlyNetworkHeal': '0', 'BatteryLowNotification': '10', 'AllowWidgetOrdering': '0', 'ActiveTimerPlan': '0', 'HideDisabledHardwareSensors': '0', 'WebTheme': 'default', 'FloorplanPopupDelay': '750', 'FloorplanFullscreenMode': '1', 'FloorplanAnimateZoom': '1', 'FloorplanShowSensorValues': '1', 'FloorplanShowSwitchValues': '1', 'FloorplanShowSceneNames': '1', 'FloorplanRoomColour': 'Blue', 'FloorplanActiveOpacity': '25', 'FloorplanInactiveOpacity': '5', 'TempHome': '20', 'TempAway': '15', 'TempComfort': '22.0', 'DegreeDaysBaseTemperature': '18.0', 'HTTPURL': 'aHR0cHM6Ly9hcGkudGVsZWdyYW0ub3JnL2JvdDkzNTQwMzk2NjpBQUhBYzhuQXBGVUlzMWpiaW5SUjMxUUZLbHQ5QWV4aFJKTS9zZW5kTWVzc2FnZT9jaGF0X2lkPSNUTyZ0ZXh0PSNNRVNTQUdF', 'HTTPPostContentType': 'YXBwbGljYXRpb24vanNvbg==', 'ShowUpdateEffect': '1', 'ShortLogInterval': '5', 'SendErrorsAsNotification': '0', 'Location': '51.462428;5.497539', 'ClickatellEnabled': '0', 'ClickatellAPI': '0', 'ClickatellFrom': '0', 'ClickatellPassword': '0', 'ClickatellTo': '0', 'ClickatellUser': '0', 'EmailFrom': '[email protected]', 'EmailServer': 'smtp.xs4all.nl', 'EmailTo': '[email protected]', 'EmailPassword': 'UmVrdGFkLWtpaGt1bi1uaWJjaTk=', 'EmailUsername': 'cHZkZ3VsaWs=', 'HTTPEnabled': '0', 'HTTPField1': '0', 'HTTPField2': '0', 'HTTPField3': '0', 'HTTPField4': '0', 'HTTPPostData': '0', 'HTTPPostHeaders': '0', 'HTTPTo': 'MTk1NjkxMzE0', 'KodiIPAddress': '224.0.0.1', 'KodiEnabled': '0', 'KodiPort': '9777', 'KodiTimeToLive': '5', 'LmsPlayerMac': '0', 'LmsDuration': '5', 'LmsEnabled': '0', 'NMAAPI': '0', 'NMAEnabled': '0', 'ProwlAPI': '0', 'ProwlEnabled': '0', 'PushALotAPI': '0', 'PushALotEnabled': '0', 'PushbulletAPI': '0', 'PushbulletEnabled': '0', 'PushoverAPI': '0', 'PushoverUser': '0', 'PushoverEnabled': '0', 'PushsaferAPI': '0', 'PushsaferEnabled': '0', 'WebUserName': 'UGlldGVy', 'WebPassword': 'd365bcd3859d7516aa76ebc7f24e0881', 'WebLocalNetworks': '127.0.0.*; 192.168.1.*;10.187.1.*;::1', 'SecPassword': 'd365bcd3859d7516aa76ebc7f24e0881', 'ProtectionPassword': 'd365bcd3859d7516aa76ebc7f24e0881', 'MyDomoticzUserId': '0', 'MyDomoticzSubsystems': '0', 'OneWireSensorPollPeriod': '0', 'OneWireSwitchPollPeriod': '0', 'EnableEventScriptSystem': '1', 'Title': 'Domoticz', 'CostEnergyR1': '2204', 'CostEnergyR2': '2204', 'WeightUnit': '0', 'DisableDzVentsSystem': '0', 'DzVentsLogLevel': '1', 'LogEventScriptTrigger': '0', 'IFTTTEnabled': '0', 'EmailEnabled': '1', 'GCMEnabled': '0', 'PushsaferImage': '0', 'TelegramAPI': '935403966:AAHAc8nApFUIs1jbinRR31QFKlt9AexhRJM', 'TelegramChat': '195691314', 'TelegramEnabled': '0', 'WebRemoteProxyIPs': '0', 'IFTTTAPI': '0', 'EventSystemLogFullURL': '0', 'FCMEnabled': '0', 'ZWaveAssumeAwake': '1', 'MaxElectricPower': '6000'}'
2021-08-21 19:19:05.124 Homekit: (Homekit) ----> '_plugin' '<plugin.BasePlugin object at 0x65ccd5d0>'
2021-08-21 19:19:05.124 Homekit: (Homekit) ----> 'json' '<module 'json' from '/usr/lib/python3.7/json/__init__.py'>'
2021-08-21 19:19:05.123 Error: Homekit: (Homekit) 'onMessage' failed 'JSONDecodeError'.
2021-08-21 19:19:05.123 Error: Homekit: (Homekit) ----> Line 202 in '/home/pi/domoticz/plugins/HomekitInsecureClient/plugin.py', function onMessage
2021-08-21 19:19:05.123 Error: Homekit: (Homekit) ----> Line 85 in '/home/pi/domoticz/plugins/HomekitInsecureClient/plugin.py', function onMessage
2021-08-21 19:19:05.123 Error: Homekit: (Homekit) ----> Line 348 in '/usr/lib/python3.7/json/__init__.py', function loads
2021-08-21 19:19:05.123 Error: Homekit: (Homekit) ----> Line 337 in '/usr/lib/python3.7/json/decoder.py', function decode
2021-08-21 19:19:05.123 Error: Homekit: (Homekit) ----> Line 355 in '/usr/lib/python3.7/json/decoder.py', function raw_decode
2021-08-21 19:19:10.068 (Homekit) Queued asynchronous read aborted (10.187.1.111:8080), [2] End of file.
2021-08-21 19:19:10.068 Homekit: (Homekit) Pushing 'DisconnectedEvent' on to queue
2021-08-21 19:19:10.100 (Homekit) Processing 'DisconnectedEvent' message
2021-08-21 19:19:10.100 Homekit: (Homekit) Disconnect event received for '10.187.1.111:8080'.
2021-08-21 19:19:10.100 Homekit: (Homekit) Pushing 'onDisconnectCallback' on to queue
2021-08-21 19:19:10.100 (Homekit) Processing 'onDisconnectCallback' message
2021-08-21 19:19:10.100 Homekit: (Homekit) Calling message handler 'onDisconnect'.
2021-08-21 19:19:10.100 Homekit: (Homekit) Connection httpGET disconnected
2021-08-21 19:19:15.023 Homekit: (Homekit) Pushing 'onHeartbeatCallback' on to queue
2021-08-21 19:19:15.073 (Homekit) Processing 'onHeartbeatCallback' message
2021-08-21 19:19:15.073 Homekit: (Homekit) Calling message handler 'onHeartbeat'.
2021-08-21 19:19:15.073 Homekit: (Homekit) Refreshing Accessories Status
2021-08-21 19:19:15.073 Homekit: (Homekit) Connection Lost. Reconnecting.
2021-08-21 19:19:15.074 Homekit: (Homekit) Pushing 'ConnectDirective' on to queue
2021-08-21 19:19:15.074 (Homekit) Processing 'ConnectDirective' message
2021-08-21 19:19:15.074 Homekit: (Homekit) Transport set to: 'TCP/IP', 10.187.1.111:8080.
2021-08-21 19:19:15.075 Homekit: (Homekit) Connect directive received, action initiated successfully.
2021-08-21 19:19:15.078 Homekit: (Homekit) Pushing 'onConnectCallback' on to queue
2021-08-21 19:19:15.125 (Homekit) Processing 'onConnectCallback' message
2021-08-21 19:19:15.125 Homekit: (Homekit) Calling message handler 'onConnect'.
2021-08-21 19:19:15.125 Homekit: (Homekit) Connection successfull
2021-08-21 19:19:17.444 Homekit: (Homekit) Pushing 'DisconnectDirective' on to queue
2021-08-21 19:19:17.444 (Homekit) Processing 'DisconnectDirective' message
2021-08-21 19:19:17.444 Homekit: (Homekit) Disconnect directive received for '10.187.1.111:8080'.
2021-08-21 19:19:17.444 (Homekit) Handling TCP disconnect, socket (10.187.1.111:8080) is connected
2021-08-21 19:19:17.446 (Homekit) Timer aborted (8080).
2021-08-21 19:19:17.446 (Homekit) Queued asynchronous read aborted (10.187.1.111:8080), [125] Operation canceled.
2021-08-21 19:19:17.447 Homekit: (Homekit) Pushing 'DisconnectedEvent' on to queue
2021-08-21 19:19:17.447 (Homekit) Processing 'DisconnectedEvent' message
2021-08-21 19:19:17.447 Homekit: (Homekit) Disconnect event received for '10.187.1.111:8080'.
2021-08-21 19:19:17.447 Homekit: (Homekit) Pushing 'onDisconnectCallback' on to queue
2021-08-21 19:19:17.447 Homekit: (Homekit) Pushing 'onStopCallback' on to queue
2021-08-21 19:19:17.447 (Homekit) Processing 'onDisconnectCallback' message
2021-08-21 19:19:17.447 Homekit: (Homekit) Calling message handler 'onDisconnect'.
2021-08-21 19:19:17.447 Homekit: (Homekit) Connection httpGET disconnected
2021-08-21 19:19:17.447 (Homekit) Processing 'onStopCallback' message
2021-08-21 19:19:17.447 Homekit: (Homekit) Calling message handler 'onStop'.
2021-08-21 19:19:17.447 Homekit: (Homekit) onStop called
2021-08-21 19:19:17.515 (Homekit) Deallocating connection object 'httpGET' (10.187.1.111:8080).
2021-08-21 19:19:17.444 Status: Homekit: (Homekit) Stop directive received.
2021-08-21 19:19:17.570 Status: Homekit: (Homekit) Exiting work loop.
2021-08-21 19:19:17.644 Status: Homekit: (Homekit) Stopping threads.
2021-08-21 19:19:17.644 Status: Homekit: (Homekit) Stopped.
Update: solved, used the http port 8080 which was not the right one. Look in Hombridge-config for the right port number!!
Last edited by pvdgulik on Tuesday 25 January 2022 23:57, edited 1 time in total.
MacJL
Posts: 51
Joined: Tuesday 22 April 2014 22:17
Target OS: OS X
Domoticz version: Beta
Location: France
Contact:

Re: Python Plugin: Homekit Insecure Client

Post by MacJL »

Hello,

I have not enough data to understand what happened.

I have published a new release of plugin with more debug logs. Could you update and post the new logs?

Regards
User avatar
Pupz
Posts: 9
Joined: Sunday 29 November 2015 22:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

Re: Python Plugin: Homekit Insecure Client

Post by Pupz »

Hello,

I updated to todays new version. Here is a log with 'Plugin Debug' mode on. Please have a look what's going on and why it's not working.

Code: Select all


2021-10-27 15:31:23.879 Homebridge Tuya Plug hardware started.
2021-10-27 15:31:23.879 Status: Homebridge Tuya Plug: (Homebridge Tuya Plug) Entering work loop.
2021-10-27 15:31:23.879 Status: Homebridge Tuya Plug: (Homebridge Tuya Plug) Started.
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) Debug logging mask set to: PYTHON
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) Plugin set in Debug Mode
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) 'HardwareID':'12'
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) 'HomeFolder':'/home/pi/domoticz/plugins/Domoticz-HomekitInsecureClient/'
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) 'StartupFolder':'/home/pi/domoticz/'
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) 'UserDataFolder':'/home/pi/domoticz/'
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) 'Database':'/home/pi/domoticz/domoticz.db'
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) 'Language':'nl'
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) 'Version':'2.1'
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) 'Author':'MacJL'
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) 'Name':'Homebridge Tuya Plug'
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) 'Address':'127.0.0.1'
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) 'Port':'8581'
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) 'Password':'729-13-481'
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) 'Key':'HomekitInsecureClient'
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) 'Mode6':'2'
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) 'DomoticzVersion':'2021.1'
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) 'DomoticzHash':'8547c5b7e'
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) 'DomoticzBuildTime':'2021-04-17 17:29:11'
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) Device count: 0
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) Initializing Homekit Insecure Client Plugin
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) Creating Connection object
2021-10-27 15:31:25.479 Homebridge Tuya Plug: (Homebridge Tuya Plug) Connecting to Homekit Device at address http://127.0.0.1:8581
2021-10-27 15:31:25.477 Status: Homebridge Tuya Plug: (Homebridge Tuya Plug) Initialized version 2.1, author 'MacJL'
2021-10-27 15:31:26.694 Homebridge Tuya Plug: (Homebridge Tuya Plug) Connection successfull
2021-10-27 15:31:33.121 Homebridge Tuya Plug: (Homebridge Tuya Plug) Refreshing Accessories Status
2021-10-27 15:31:33.121 Homebridge Tuya Plug: (Homebridge Tuya Plug) Connection is alive. Sending /accessories command
2021-10-27 15:31:33.172 Homebridge Tuya Plug: (Homebridge Tuya Plug) Data received
2021-10-27 15:31:33.172 Homebridge Tuya Plug: (Homebridge Tuya Plug) <!DOCTYPE html><html lang="en"><head>
2021-10-27 15:31:33.173 Error: Homebridge Tuya Plug: (Homebridge Tuya Plug) 'onMessage' failed 'JSONDecodeError'.
2021-10-27 15:31:33.173 Error: Homebridge Tuya Plug: (Homebridge Tuya Plug) ----> Line 203 in '/home/pi/domoticz/plugins/Domoticz-HomekitInsecureClient/plugin.py', function onMessage
2021-10-27 15:31:33.173 Error: Homebridge Tuya Plug: (Homebridge Tuya Plug) ----> Line 86 in '/home/pi/domoticz/plugins/Domoticz-HomekitInsecureClient/plugin.py', function onMessage
2021-10-27 15:31:33.173 Error: Homebridge Tuya Plug: (Homebridge Tuya Plug) ----> Line 348 in '/usr/lib/python3.7/json/__init__.py', function loads
2021-10-27 15:31:33.173 Error: Homebridge Tuya Plug: (Homebridge Tuya Plug) ----> Line 337 in '/usr/lib/python3.7/json/decoder.py', function decode
2021-10-27 15:31:33.173 Error: Homebridge Tuya Plug: (Homebridge Tuya Plug) ----> Line 355 in '/usr/lib/python3.7/json/decoder.py', function raw_decode
2021-10-27 15:31:38.177 Homebridge Tuya Plug: (Homebridge Tuya Plug) Connection httpGET disconnected
2021-10-27 15:31:43.064 Homebridge Tuya Plug: (Homebridge Tuya Plug) Refreshing Accessories Status
2021-10-27 15:31:43.064 Homebridge Tuya Plug: (Homebridge Tuya Plug) Connection Lost. Reconnecting.
2021-10-27 15:31:43.115 Homebridge Tuya Plug: (Homebridge Tuya Plug) Connection successfull
2021-10-27 15:31:53.087 Homebridge Tuya Plug: (Homebridge Tuya Plug) Refreshing Accessories Status
2021-10-27 15:31:53.087 Homebridge Tuya Plug: (Homebridge Tuya Plug) Connection is alive. Sending /accessories command
2021-10-27 15:31:53.138 Homebridge Tuya Plug: (Homebridge Tuya Plug) Data received
2021-10-27 15:31:53.138 Homebridge Tuya Plug: (Homebridge Tuya Plug) <!DOCTYPE html><html lang="en"><head>
2021-10-27 15:31:53.138 Error: Homebridge Tuya Plug: (Homebridge Tuya Plug) 'onMessage' failed 'JSONDecodeError'.
2021-10-27 15:31:53.138 Error: Homebridge Tuya Plug: (Homebridge Tuya Plug) ----> Line 203 in '/home/pi/domoticz/plugins/Domoticz-HomekitInsecureClient/plugin.py', function onMessage
2021-10-27 15:31:53.138 Error: Homebridge Tuya Plug: (Homebridge Tuya Plug) ----> Line 86 in '/home/pi/domoticz/plugins/Domoticz-HomekitInsecureClient/plugin.py', function onMessage
2021-10-27 15:31:53.138 Error: Homebridge Tuya Plug: (Homebridge Tuya Plug) ----> Line 348 in '/usr/lib/python3.7/json/__init__.py', function loads
2021-10-27 15:31:53.138 Error: Homebridge Tuya Plug: (Homebridge Tuya Plug) ----> Line 337 in '/usr/lib/python3.7/json/decoder.py', function decode
2021-10-27 15:31:53.138 Error: Homebridge Tuya Plug: (Homebridge Tuya Plug) ----> Line 355 in '/usr/lib/python3.7/json/decoder.py', function raw_decode

MacJL
Posts: 51
Joined: Tuesday 22 April 2014 22:17
Target OS: OS X
Domoticz version: Beta
Location: France
Contact:

Re: Python Plugin: Homekit Insecure Client

Post by MacJL »

Understood what your problem is. You are not using the Homebridge HomeKit port, but the Homebridge console port.
To find the Homebridge port, see in the config what port is configured in the bridge section. For me, it’s the 51506, but could be some other random port.
User avatar
Pupz
Posts: 9
Joined: Sunday 29 November 2015 22:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

Re: Python Plugin: Homekit Insecure Client

Post by Pupz »

You gave me new hope. I changed to the right port. But alas, still no luck.

Here's the log. This pattern repeats every 10 seconds.

Code: Select all

2021-11-02 23:03:07.099 Homebridge Tuya Plug: (Homebridge Tuya Plug) Refreshing Accessories Status
2021-11-02 23:03:07.099 Homebridge Tuya Plug: (Homebridge Tuya Plug) Connection is alive. Sending /accessories command
2021-11-02 23:03:07.804 Homebridge Tuya Plug: (Homebridge Tuya Plug) Data received
2021-11-02 23:03:07.805 Homebridge Tuya Plug: (Homebridge Tuya Plug) {"accessories":[{"aid":1,"services":[{"type":"3E","iid":1,"characteristics":[{"type":"14","iid":2,"perms":["pw"],"description":"Identify","format":"bool"},{"type":"20","iid":3,"value":"homebridge.io","perms":["pr"],"description":"Manufacturer","format":"string","maxLen":64},{"type":"21","iid":4,"value":"homebridge","perms":["pr"],"description":"Model","format":"string","maxLen":64},{"type":"23","iid":5,"value":"Homebridge EED6 DC99","perms":["pr"],"description":"Name","format":"string","maxLen":64},{"type":"30","iid":6,"value":"0E:D7:D2:EA:EE:D6","perms":["pr"],"description":"Serial Number","format":"string","maxLen":64},{"type":"52","iid":7,"value":"1.3.5","perms":["pr"],"description":"Firmware Revision","format":"string"}]},{"type":"A2","iid":2000000008,"characteristics":[{"type":"37","iid":9,"value":"1.1.0","perms":["pr"],"description":"Version","format":"string","maxLen":64}]}]},{"aid":2,"services":[{"type":"3E","iid":1,"characteristics":[{"type":"14","iid":2,"perms":["pw"],"description":"Identify","format":"bool"},{"type":"20","iid":3,"value":"eDomoticz","perms":["pr"],"description":"Manufacturer","format":"string","maxLen":64},{"type":"21","iid":4,"value":"Lighting 2","perms":["pr"],"description":"Model","format":"string","maxLen":64},{"type":"23","iid":5,"value":"APPLE media","perms":["pr"],"description":"Name","format":"string","maxLen":64},{"type":"30","iid":6,"value":"Domoticz IDX 88","perms":["pr"],"description":"Serial Number","format":"string","maxLen":64},{"type":"52","iid":7,"value":"2.1.38","perms":["pr"],"description":"Firmware Revision","format":"string"}]},{"type":"49","iid":8,"characteristics":[{"type":"23","iid":9,"value":"APPLE media","perms":["pr"],"description":"Name","format":"string","maxLen":64},{"type":"25","iid":10,"value":0,"perms":["ev","pr","pw"],"description":"On","format":"bool"}]}]},{"aid":3,"services":[{"type":"3E","iid":1,"characteristics":[{"type":"14","iid":2,"perms":["pw"],"description":"Identify","format":"bool"},{"type":"20","iid":3,"value":"eDomoticz","perms":["pr"],"description":"Manufacturer","format":"string","maxLen":64},{"type":"21","iid":4,"value":"Light/Switch","perms":["pr"],"description":"Model","format":"string","maxLen":64},{"type":"23","iid":5,"value":"AchterMaan","perms":["pr"],"description":"Name","format":"string","maxLen":64},{"type":"30","iid":6,"value":"Domoticz IDX 146","perms":["pr"],"description":"Serial Number","format":"string","maxLen":64},{"type":"52","iid":7,"value":"2.1.38","perms":["pr"],"description":"Firmware Revision","format":"string"}]},{"type":"43","iid":8,"characteristics":[{"type":"23","iid":9,"value":"AchterMaan","perms":["pr"],"description":"Name","format":"string","maxLen":64},{"type":"25","iid":10,"value":1,"perms":["ev","pr","pw"],"description":"On","format":"bool"}]}]},{"aid":4,"services":[{"type":"3E","iid":1,"characteristics":[{"type":"14","iid":2,"perms":["pw"],"description":"Identify","format":"bool"},{"type":"20","iid":3,"value":"eDomoticz","perms":["pr"],"description":"Manufacturer","format":"string","maxLen":64},{"type":"21","iid":4,"value":"Color Switch","perms":["pr"],"description":"Model","format":"string","maxLen":64},{"type":"23","iid":5,"value":"Bureau","perms":["pr"],"description":"Name","format":"string","maxLen":64},{"type":"30","iid":6,"value":"Domoticz IDX 166","perms":["pr"],"description":"Serial Number","format":"string","maxLen":64},{"type":"52","iid":7,"value":"2.1.38","perms":["pr"],"description":"Firmware Revision","format":"string"}]},{"type":"43","iid":8,"characteristics":[{"type":"23","iid":9,"value":"Bureau","perms":["pr"],"description":"Name","format":"string","maxLen":64},{"type":"25","iid":10,"value":1,"perms":["ev","pr","pw"],"description":"On","format":"bool"},{"type":"8","iid":11,"value":66,"perms":["ev","pr","pw"],"description":"Brightness","format":"int","unit":"percentage","minValue":0,"maxValue":100,"minStep":1},{"type":"13","iid":12,"value":0,"perms":["ev","pr","pw"],"description":"Hue","format":"float","unit":"arcdegrees","minValue":0,"maxValue":360,"minStep":1},{"type":"2F","iid":13,"value":0,"perms":["ev","pr","pw"],"description":"Saturation","format":"float","unit":"percentage","minValue":0,"maxValue":100,"minStep":1}]}]},{"aid":5,"services":[{"type":"3E","iid":1,"characteristics":[{"type":"14","iid":2,"perms":["pw"],"description":"Identify","format":"bool"},{"type":"20","iid":3,"value":"eDomoticz","perms":["pr"],"description":"Manufacturer","format":"string","maxLen":64},{"type":"21","iid":4,"value":"Light/Switch","perms":["pr"],"description":"Model","format":"string","maxLen":64},{"type":"23","iid":5,"value":"DENON - Volume","perms":["pr"],"description":"Name","format":"string","maxLen":64},{"type":"30","iid":6,"value":"Domoticz IDX 23","perms":["pr"],"description":"Serial Number","format":"string","maxLen":64},{"type":"52","iid":7,"value":"2.1.38","perms":["pr"],"description":"Firmware Revision","format":"string"}]},{"type":"43","iid":8,"characteristics":[{"type":"23","iid":9,"value":"DENON - Volume","perms":["pr"],"description":"Name","format":"string","maxLen":64},{"type":"25","iid":10,"value":0,"perms":["ev","pr","pw"],"description":"On","format":"bool"},{"type":"8","iid":11,"value":57,"perms":["ev","pr","pw"],"description":"Brightness","format":"int","unit":"percentage","minValue":0,"maxValue":100,"minStep":1}]}]},{"aid":6,"services":[{"type":"3E","iid":1,"characteristics":[{"type":"14","iid":2,"perms":["pw"],"description":"Identify","format":"bool"},{"type":"20","iid":3,"value":"eDomoticz","perms":["pr"],"description":"Manufacturer","format":"string","maxLen":64},{"type":"21","iid":4,"value":"Lighting 2","perms":["pr"],"description":"Model","format":"string","maxLen":64},{"type":"23","iid":5,"value":"DENON media","perms":["pr"],"description":"Name","format":"string","maxLen":64},{"type":"30","iid":6,"value":"Domoticz IDX 90","perms":["pr"],"description":"Serial Number","format":"string","maxLen":64},{"type":"52","iid":7,"value":"2.1.38","perms":["pr"],"description":"Firmware Revision","format":"string"}]},{"type":"49","iid":8,"characteristics":[{"typ
2021-11-02 23:03:07.810 Homebridge Tuya Plug: (Homebridge Tuya Plug) Device homebridge.io - AID=1 - Type of Service=A2 - Not supported yet
2021-11-02 23:03:07.810 Homebridge Tuya Plug: (Homebridge Tuya Plug) [{'type': '25', 'iid': 9, 'value': 1, 'perms': ['ev', 'pr', 'pw'], 'description': 'On', 'format': 'bool'}]
2021-11-02 23:03:07.810 Homebridge Tuya Plug: (Homebridge Tuya Plug) @milo526/homebridge-tuya-web : NoName - DeviceID=49-37-9 - DomoticzID=-1 - Current Value=1
2021-11-02 23:03:07.811 Homebridge Tuya Plug: (Homebridge Tuya Plug) Create domoticz device :"NoName" with ID=1 and DeviceID=49-37-9 of type Switch
2021-11-02 23:03:07.811 Homebridge Tuya Plug: (Homebridge Tuya Plug) Device created: NoName - DeviceID=49-37-9
2021-11-02 23:03:07.811 Error: (Homebridge Tuya Plug) Device creation failed, Domoticz settings prevent accepting new devices.
2021-11-02 23:03:07.811 Error: Homebridge Tuya Plug: (Homebridge Tuya Plug) 'onMessage' failed 'KeyError'.
2021-11-02 23:03:07.811 Error: Homebridge Tuya Plug: (Homebridge Tuya Plug) ----> Line 203 in '/home/pi/domoticz/plugins/Domoticz-HomekitInsecureClient/plugin.py', function onMessage
2021-11-02 23:03:07.811 Error: Homebridge Tuya Plug: (Homebridge Tuya Plug) ----> Line 124 in '/home/pi/domoticz/plugins/Domoticz-HomekitInsecureClient/plugin.py', function onMessage

User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Plugin: Homekit Insecure Client

Post by Dnpwwo »

This:

Code: Select all

2021-11-02 23:03:07.811 Error: (Homebridge Tuya Plug) Device creation failed, Domoticz settings prevent accepting new devices.
is probably the issue. You have new device creation disabled in the 'Settings' tab so the plugin can't create new devices (and doesn't handle it very elegantly).

If you enable device creation then restart the plugin it may work.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
User avatar
Pupz
Posts: 9
Joined: Sunday 29 November 2015 22:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

Re: Python Plugin: Homekit Insecure Client

Post by Pupz »

@Dnpwwo
Great, it's working now! I was too busy decrypting the JSON debugging info, that I overlooked this one :?
Thanks.

Also thanks @MacJL for this plugin and the support.
JonyBCN
Posts: 39
Joined: Tuesday 24 May 2016 22:39
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Homekit Insecure Client

Post by JonyBCN »

MacJL wrote: Tuesday 27 April 2021 12:05
PS : It's not same thing as homebridge-eDomoticz (control Domoticz from Apple Home). This plugin works on the opposite way (Control Homekit device from Domoticz)
Small detail in case someone overlooks it: remember to exclude the devices created in eDomoticz or duplicates will appear in the Homebridge / iOS Home app.

Thanks for the plugin, it will be quite useful for me to be able to add devices to events in domoticz.
JonyBCN
Posts: 39
Joined: Tuesday 24 May 2016 22:39
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Homekit Insecure Client

Post by JonyBCN »

After a few days with the plugin working without problems, I have noticed that Domoticz was constantly restarting on my raspberry.

The truth is that it was difficult for me to find the error, but after investigating the LOG I have seen this:

Error: Homekit NAS: (Homekit NAS) Failed to connect (111) to: 192.168.1.99:51824 with error: Connection refused
Error: Domoticz (pid: 21142, tid: 21174 ('Plugin_ASIO')) received fatal signal 11 (Segmentation fault)


The bug has been fixed by deactivating the plugin, so I am 90% convinced that it is related.
MacJL
Posts: 51
Joined: Tuesday 22 April 2014 22:17
Target OS: OS X
Domoticz version: Beta
Location: France
Contact:

Re: Python Plugin: Homekit Insecure Client

Post by MacJL »

JonyBCN wrote: Monday 27 December 2021 20:34 After a few days with the plugin working without problems, I have noticed that Domoticz was constantly restarting on my raspberry.

The truth is that it was difficult for me to find the error, but after investigating the LOG I have seen this:

Error: Homekit NAS: (Homekit NAS) Failed to connect (111) to: 192.168.1.99:51824 with error: Connection refused
Error: Domoticz (pid: 21142, tid: 21174 ('Plugin_ASIO')) received fatal signal 11 (Segmentation fault)


The bug has been fixed by deactivating the plugin, so I am 90% convinced that it is related.
Hello,

I had similar issue some times ago. I resolved it by removing some plugins, but not necessarily this one.
I think Domoticz may have issue when having too many plugins. Could you test if deactivating another plugin also resolve your problem ?
And is your domoticz up-to-date ?

Regards,
JonyBCN
Posts: 39
Joined: Tuesday 24 May 2016 22:39
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Homekit Insecure Client

Post by JonyBCN »

You are absolutely right. I have disabled some plugins and the operation seems to be correct again. There was an assumption that it was the plugin because it was the last one installed.
Thank you.
nigels0
Posts: 221
Joined: Thursday 23 January 2014 12:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

Re: Python Plugin: Homekit Insecure Client

Post by nigels0 »

Thank you very much for the plug-in!

I’m puzzled that as I’m using homebridge edomoticz, would there be a circular reference for devices - so ones that I’ve surfaced to HomeKit via Homebridge e Domoticz would then be added into Domoticz list of devices by this plug-in - thereby having two copies of some devices - one ‘native to Domoticz, and the second pulled from Homebridge back into Domoticz. If you see what I mean?
MacJL
Posts: 51
Joined: Tuesday 22 April 2014 22:17
Target OS: OS X
Domoticz version: Beta
Location: France
Contact:

Re: Python Plugin: Homekit Insecure Client

Post by MacJL »

Hello,

To avoid that kind of problems, when the manufacturer is « eDomoticz », the device is excluded. So you should not have problems with that.
nigels0
Posts: 221
Joined: Thursday 23 January 2014 12:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

Re: Python Plugin: Homekit Insecure Client

Post by nigels0 »

Ideal.
hendryman
Posts: 9
Joined: Sunday 22 October 2017 16:20
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Homekit Insecure Client

Post by hendryman »

Great Plugin! I have two questions:

- 1. When I turn the switch in HomeKit on/off, the switch in domoticz doesn't reflect the status change. How can I fix this?

- 2. I often (and randomly) get error like this one when I change a HomeKit switch in domoticz, and the switch change doesn't get transmitted to HomeKit:

Code: Select all

2023-02-27 11:39:05.139 Error: HomeKit: (HomeKit) No transport, write directive to 'httpGET' ignored.
2023-02-27 11:30:11.734 Error: Domoticz(pid:21264, tid:21293('Plugin_ASIO')) received fatal signal 11 (Segmentation fault)
2023-02-27 11:30:11.734 Error: siginfo address=0x5310, address=(nil)
What can I do?
Filnet
Posts: 23
Joined: Tuesday 06 March 2018 13:55
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Homekit Insecure Client

Post by Filnet »

Hello,

I don't see any device in the list of my domoticz.
NB: "New devices accepted" is on

Can you help me?
Best regards

Filnet

Code: Select all

2023-04-25 18:06:24.867 Status: Homekit Client: Started.
2023-04-25 18:06:25.066 Homekit Client: Debug logging mask set to: PYTHON
2023-04-25 18:06:25.067 Homekit Client: Plugin set in Debug Mode
2023-04-25 18:06:25.067 Homekit Client: 'HardwareID':'41'
2023-04-25 18:06:25.067 Homekit Client: 'HomeFolder':'/home/pi/domoticz/plugins/HomekitInsecureClient/'
2023-04-25 18:06:25.067 Homekit Client: 'StartupFolder':'/home/pi/domoticz/'
2023-04-25 18:06:25.067 Homekit Client: 'UserDataFolder':'/home/pi/domoticz/'
2023-04-25 18:06:25.067 Homekit Client: 'Database':'/home/pi/domoticz/domoticz.db'
2023-04-25 18:06:25.067 Homekit Client: 'Language':'fr'
2023-04-25 18:06:25.067 Homekit Client: 'Version':'2.1'
2023-04-25 18:06:25.067 Homekit Client: 'Author':'MacJL'
2023-04-25 18:06:25.067 Homekit Client: 'Name':'Homekit Client'
2023-04-25 18:06:25.067 Homekit Client: 'Address':'localhost'
2023-04-25 18:06:25.067 Homekit Client: 'Port':'51199'
2023-04-25 18:06:25.067 Homekit Client: 'Password':'XXX-XX-XXX''
2023-04-25 18:06:25.068 Homekit Client: 'Key':'HomekitInsecureClient'
2023-04-25 18:06:25.068 Homekit Client: 'Mode6':'2'
2023-04-25 18:06:25.068 Homekit Client: 'DomoticzVersion':'2023.1 (build 15215)'
2023-04-25 18:06:25.068 Homekit Client: 'DomoticzHash':'ddc839261'
2023-04-25 18:06:25.068 Homekit Client: 'DomoticzBuildTime':'2023-04-25 14:59:32'
2023-04-25 18:06:25.068 Homekit Client: Device count: 0
2023-04-25 18:06:25.068 Homekit Client: Initializing Homekit Insecure Client Plugin
2023-04-25 18:06:25.068 Homekit Client: Creating Connection object
2023-04-25 18:06:25.068 Homekit Client: Connecting to Homekit Device at address http://localhost:51199
2023-04-25 18:06:25.119 Homekit Client: Connection successfull
2023-04-25 18:06:25.063 Status: Homekit Client: Initialized version 2.1, author 'MacJL'
2023-04-25 18:06:34.098 Homekit Client: Refreshing Accessories Status
2023-04-25 18:06:34.099 Homekit Client: Connection is alive. Sending /accessories command
2023-04-25 18:06:34.301 Homekit Client: Data received
2023-04-25 18:06:34.301 Homekit Client: {"accessories":.....
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest