pyscript icon indicating copy to clipboard operation
pyscript copied to clipboard

Multiple instances of an app

Open bjornorri opened this issue 4 months ago • 0 comments

I'm an AppDaemon user and have been looking into using pyscript instead.

One thing I love about AppDaemon is the ability to instantiate an app multiple times with different parameters:

bedroom_light_control:
  module: light_control
  class: LightControl
  binary_sensor: binary_sensor.bedroom_occupied
  area_id: bedroom
  ...

bathroom_light_control:
  module: light_control
  class: LightControl
  binary_sensor: binary_sensor.bathroom_occupied
  area_id: bathroom
  ...

It seems to me that pyscript doesn't support this. The documentation shows an example of apps with multiple sets of parameters, but it looks like the "parallelization" needs to be implemented by the app itself.

I find this problematic because:

  1. It is complex. I want to focus on the logic of my app and avoid extra logic and boilerplate.
  2. If one "instance" of my app crashes, they all crash. If they were actually running as separate instances, the failure would be isolated.

Is it correct that this kind of multi-instantiation is not supported in pyscript? Is it something you would consider supporting?

bjornorri avatar Oct 20 '24 15:10 bjornorri