From 6d31d56c03d7c869cba0c13fced1e6f808fe9445 Mon Sep 17 00:00:00 2001 From: Jc2k Date: Mon, 22 Apr 2019 20:07:03 +0100 Subject: [PATCH] Backport missing folder fix from #23191 (#23297) --- homeassistant/components/homekit_controller/connection.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/homekit_controller/connection.py b/homeassistant/components/homekit_controller/connection.py index 2ca568b547..032032d30a 100644 --- a/homeassistant/components/homekit_controller/connection.py +++ b/homeassistant/components/homekit_controller/connection.py @@ -145,9 +145,14 @@ class HKDevice(): self.pairing = self.controller.pairings.get(self.hkid) if self.pairing is not None: - pairing_file = os.path.join( + pairing_dir = os.path.join( self.hass.config.path(), HOMEKIT_DIR, + ) + if not os.path.exists(pairing_dir): + os.makedirs(pairing_dir) + pairing_file = os.path.join( + pairing_dir, PAIRING_FILE, ) self.controller.save_data(pairing_file)