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

problem in base_conditional.py #1209

Closed Mondgans closed 2 years ago

Mondgans commented 2 years ago

https://github.com/kizniche/Mycodo/commit/fcd124783ec38490c155529e0856d4c612a9ff83#commitcomment-77069592

I upgraded to master and run in an error with my conditional controllers. It impacts all existing controllers. 2022-06-27 11:23:15,984 - INFO - mycodo.controllers.controller_conditional_2d71cdb5 - Activated in 117.2 ms 2022-06-27 11:23:26,055 - ERROR - mycodo.controllers.controller_conditional_2d71cdb5 - Exception executing Conditional Statement code Traceback (most recent call last): File "/var/mycodo-root/mycodo/controllers/controller_conditional.py", line 178, in check_conditionals self.conditional_run.conditional_code_run() File "/home/pi/Mycodo/mycodo/user_python_code/conditional_2d71cdb5-a0d2-4802-8ffb-b337d553dea6.py", line 29, in conditional_code_run measurement = self.condition("c29c7f38-c4de-447d-9d8a-681341cbdce6") File "/var/mycodo-root/mycodo/controllers/base_conditional.py", line 66, in condition if cond: UnboundLocalError: local variable 'cond' referenced before assignment

kizniche commented 2 years ago

Thanks for the bug report. I just committed a fix.