Skip to content
This repository was archived by the owner on Jan 18, 2021. It is now read-only.

Commit 32ec366

Browse files
committed
Added fix for local version detection.
1 parent a772bad commit 32ec366

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

custom_components/custom_updater.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import homeassistant.helpers.config_validation as cv
1616
from homeassistant.helpers.event import track_time_interval
1717

18-
__version__ = '1.4.0'
18+
__version__ = '1.4.1'
1919

2020
_LOGGER = logging.getLogger(__name__)
2121

@@ -234,13 +234,20 @@ def get_local_version(self, card):
234234
cardconfig = ''
235235
if self._lovelace_gen:
236236
conf_file = self.ha_conf_dir + '/lovelace/main.yaml'
237+
with open(conf_file, 'r') as local:
238+
for line in local.readlines():
239+
if card + '.js' in line:
240+
cardconfig = line
241+
break
242+
local.close()
237243
else:
238244
conf_file = self.ha_conf_dir + '/ui-lovelace.yaml'
239-
with open(conf_file, 'r') as local:
240-
for line in local.readlines():
241-
if card + '.js' in line:
242-
cardconfig = line
243-
break
245+
with open(conf_file, 'r') as local:
246+
for line in local.readlines():
247+
if '/' + card + '.js' in line:
248+
cardconfig = line
249+
break
250+
local.close()
244251
if '=' in cardconfig:
245252
localversion = cardconfig.split('=')[1].split('\n')[0]
246253
_LOGGER.debug('Local version of %s is %s', card, localversion)

0 commit comments

Comments
 (0)