Visual bug activ and inactiv function

Hi together :slight_smile:

I came across a visual error where the active function is actually the inactive function and vice versa.

Here the Log file:

Traceback (most recent call last):
File “/opt/Mycodo/mycodo/controllers/controller_function.py”, line 79, in loop
self.run_function.loop()
File “/opt/Mycodo/mycodo/functions/bang_bang.py”, line 188, in loop
if last_measurement[1] > (self.setpoint + self.hysteresis):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ‘>’ not supported between instances of ‘NoneType’ and ‘float’
2025-04-01 18:03:14,519 - DEBUG - mycodo.outputs.on_off_mqtt_dff865a4 - output_on_off(off, 0, None, 0.0, 0.0, True)
2025-04-01 18:03:14,521 - DEBUG - mycodo.outputs.on_off_mqtt_dff865a4 - Output dff865a4-e0a2-4d17-b072-c674d52579e8 CH0 (Temp) OFF at 2025-04-01 18:03:14. Output returned: None
2025-04-01 18:03:14,554 - INFO - mycodo.controllers.controller_function_da8c3832 - Deactivated in 256.2 ms
2025-04-01 18:03:21,883 - INFO - mycodo.function.bang_bang_da8c3832 - Bang-Bang controller started with options: Measurement Device: bd0acb27-28f8-4531-a933-c31dda2ba17d, Measurement: efa776fe-4072-4358-a235-8ec4692a80fb, Output: dff865a4-e0a2-4d17-b072-c674d52579e8, Output_Channel: 0, Setpoint: 17.0, Hysteresis: 3.0, Direction: raise, Period: 30.0
2025-04-01 18:03:21,883 - INFO - mycodo.controllers.controller_function_da8c3832 - Activated in 328.4 ms
2025-04-01 18:03:22,072 - ERROR - mycodo.controllers.controller_function_da8c3832 - Exception while running loop()
Traceback (most recent call last):
File “/opt/Mycodo/mycodo/controllers/controller_function.py”, line 79, in loop
self.run_function.loop()
File “/opt/Mycodo/mycodo/functions/bang_bang.py”, line 188, in loop
if last_measurement[1] > (self.setpoint + self.hysteresis):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I would be greatfull for any help

Your mesaurement is None. Measurements are needed for it to function properly.

Hey Kyle Thank you so much for your help. It’s a bit odd because I see measurements in the live measurement segment the whole time.

After your massage, I turned on the output of the temperature manually to raise it, and now it works fine again. Do you have a suggestion for what the problem might be? It seems that my system can’t work properly for a certain time and always runs into this state.

There’s not enough information to say what the issue is. You could simply have your input period longer than the max age set for the function measurement. If the function doesn’t have a measurement available, it can’t run.

1 Like

They had the same period of 30 seconds. I now changed them to Input 30 seconds:

and the max age to 120 seconds:

Thanks for the tip! I’m a complete newbie and really thankful for any help. Sry if the questions might be dumb.

1 Like

The same period shouldn’t cause an issue. How often did the error occur? And the function could not recover after the error?

I would say once per week. If I turn the output on manually and the value rises over a certain level, the system works fine again. Might the router connection be a problem if there is a delay of some kind? Because I always see the values of my measurements, but sometimes I can’t connect to Mycodo.

It’s important to understand what is actually causing the issue: the input, the output, or the function. This is the first time I’ve heard of the bang bang function not working, with probably years of combined use of it among all the users using it, so I would lean to think there’s an issue elsewhere. But I’m open to the possibility, I would just need to see evidence (relevant log lines) to be able to first be able to replicate the issue, before I would be able to develop a fix. I’ll do a quick review of the relevant code and see if anything looks awry.