Skip to content

How can I get the return value from a Python script #42

@eric2100

Description

@eric2100

How can I get the return value from a Python script? thank you.

action: notify.mobile_app_iphone metadata: {} data: message: aa{{ resp.success }}

action: python_script.exec metadata: {} data: file: /config/python_scripts/hello_world.py response_variable: resp

/config/python_scripts/hello_world.py
`from datetime import datetime
import logging

logger = logging.getLogger(name)

def run(hass, data, logger):
result = {"temperature": 25, "humidity": 60}
return {"success": True, "data": result}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions