Skip to content

Can't figure out how to access pyscript.app_config #313

Closed
@fovea1959

Description

@fovea1959

I have this script:

import pyscript

@state_trigger('switch.sonoff_s31_9e8c80', state_check_now=True, kwargs={'a': 'sonoff'})
def openweathermap_updated(**kwargs):
    log.info(f'got arguments {kwargs}')
    try:
        log.info(f'... and {pyscript.app_config}')
    except Exception as error:
        log.error(f'wth, can\'t get app_config: {error}')

and this configuration:

apps:
  openweather_update:
    wleds:
      - a
      - b
    tasmotas:
      - c
      - d

I keep getting this:

2022-02-03 23:40:20 INFO (MainThread) [custom_components.pyscript.file.openweathermap_update.openweathermap_updated] got arguments {'trigger_type': 'state', 'var_name': 'switch.sonoff_s31_9e8c80', 'value': 'on', 'old_value': 'off', 'context': Context(user_id=None, parent_id=None, id='0ad6760f6b02e79356340644eb3501f1'), 'a': 'sonoff'}
2022-02-03 23:40:20 ERROR (MainThread) [custom_components.pyscript.file.openweathermap_update.openweathermap_updated] wth, can't get app_config: module 'pyscript' has no attribute 'app_config'

I don't understand why I can't access the app_config; what am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions