kizniche / Mycodo

An environmental monitoring and regulation system
http://kylegabriel.com/projects/
GNU General Public License v3.0
2.95k stars 494 forks source link

Conditional function - Undefined variable 'timeout' #1220

Closed JulienCheny closed 2 years ago

JulienCheny commented 2 years ago

Description

Hi, I can't execute any function there is an error for all of them. It say that the "timeout" variable isn't defined. This bug happens even to the default program.

Versions:

Reproducibility

  1. Go to Function
  2. Add "Conditional Controller"
  3. Open the Configure panel of the function just added
  4. Save the default program

Expected behavior

The timeout variable should be took from the "Timeout (seconds)" edit field And initialized before this : control = DaemonControl(pyro_timeout={timeout})

Error

Traceback (most recent call last): File "/var/mycodo-root/mycodo/controllers/base_controller.py", line 72, in run self.initialize_variables() File "/var/mycodo-root/mycodo/controllers/controller_conditional.py", line 133, in initialize_variables spec.loader.exec_module(conditional_run) File "", line 790, in exec_module File "", line 228, in _call_with_frames_removed File "/home/pi/Mycodo/mycodo/user_python_code/conditional_861387d0-33d5-482d-ac0e-c904716674e0.py", line 6, in control = DaemonControl(pyro_timeout={timeout}) NameError: name 'timeout' is not defined

Generated program

1: import os 2: import sys 3: sys.path.append(os.path.abspath('/var/mycodo-root')) 4: from mycodo.controllers.base_conditional import AbstractConditional 5: from mycodo.mycodo_client import DaemonControl 6: control = DaemonControl(pyro_timeout={timeout}) 7: ...

kizniche commented 2 years ago

Fix released. Thanks for the bug report.

kizniche commented 2 years ago

This issue has been mentioned on Radical DIY Forum. There might be relevant details there:

https://forum.radicaldiy.com/t/mycodo-v8-14-0-release/1136/2