Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
skrashevich committed Jul 28, 2023
1 parent fd0ba90 commit edd9032
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions custom_components/python_script/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@
logger = logging.getLogger(__name__)


async def async_setup_platform(hass, config, add_entities,
discovery_info=None):
async def async_setup_platform(hass, config, add_entities, discovery_info=None):
try:
if 'file' in config:
finename = hass.config.path(config['file'])
with open(finename, 'rt', encoding='utf-8') as f:
if "file" in config:
finename = hass.config.path(config["file"])
with open(finename, "rt", encoding="utf-8") as f:
source = f.read()
elif 'source' in config:
source = config['source']
elif "source" in config:
source = config["source"]
else:
return
code = compile(source, '<string>', 'exec')
code = compile(source, "<string>", "exec")
add_entities([PythonSensor(code, config)])

except:
Expand Down

0 comments on commit edd9032

Please sign in to comment.