-
Logger: custom_components.pyscript.file.wall_box_start.get_new_price Exception in <file.wall_box_start.get_new_price> line 22: daten.sort(key=sort_price) ^ TypeError: '<' not supported between instances of 'coroutine' and 'coroutine'
and
also fails ... so how to do sub functions ? bonus: how to check debug of integration ist on / off ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
lambda works fine: @service
def get_new_price(trigger_type=None, var_name=None, value=None, old_value=None, context=None, **kwargs):
daten = [
{'date': '2025-07-15T05:00:00.000Z', 'price': 29.36},
{'date': '2025-07-15T06:00:00.000Z', 'price': 28.58}
]
result = sorted(daten, key=lambda x: x['price'], reverse=False)
log.debug(f"{__name__}:\n{str_.__class__.__name__} {str_}") |
Beta Was this translation helpful? Give feedback.
-
The issue is that all functions in pyscript are async. Python's list |
Beta Was this translation helpful? Give feedback.
lambda works fine: