MH-z19B changing from dev/USB0 to dev/USB1 and vice versa again and again

Hello everyone, since I connect the mh-z19b, from time to time was showing
0 ppm and if i look in daemon log appears like ‘‘device is not set up’’
Then i try to change the port direction from dev/usb0 to dev/usb 1 and it was showing again 400ppm.
the same process occur again in the reverse direction.

I appreciate any help. Saludos

1 Like

This is likely the issue you’re observing: Device Notes: USB Device Persistence Across Reboots

thanks a lot, i allready did but i still have some problems, sometimes is not readding and shows None. I check at daemon logs and i see a bad checksum at first and start to show well soome minutes, but again show None.
I am looking for the fix.

2022-11-26 20:40:36,176 - INFO - mycodo.controllers.controller_conditional_60f0603e - This INFO log entry will appear in the Daemon Log
2022-11-26 20:40:36,276 - INFO - mycodo.controllers.controller_conditional_60f0603e - Measurement value is None
2022-11-26 20:41:36,125 - INFO - mycodo.controllers.controller_conditional_60f0603e - This INFO log entry will appear in the Daemon Log
2022-11-26 20:41:36,210 - INFO - mycodo.controllers.controller_conditional_60f0603e - Measurement value is None
2022-11-26 20:41:50,699 - INFO - mycodo.controllers.controller_input_c5bc31a8 - Deactivated in 79.8 ms
2022-11-26 20:41:52,150 - INFO - mycodo.controllers.controller_input_c5bc31a8 - Activated in 261.6 ms
2022-11-26 20:41:52,205 - ERROR - mycodo.inputs.mh_z19b_c5bc31a8 - Bad checksum
2022-11-26 20:42:36,269 - INFO - mycodo.controllers.controller_conditional_60f0603e - This INFO log entry will appear in the Daemon Log
2022-11-26 20:42:36,365 - INFO - mycodo.controllers.controller_conditional_60f0603e - Measurement value is 1219.0

That sounds like a completely different issue than not using the correct device. For connectivity issues, it’s likely an issue with using too long wires and/or your connections aren’t secure.

wires is not than 1.5 metters, i will look for my configuration of tje conditional controller, i think i did a error, because the log mark something like that: ‘‘TypeError: ‘float’ object is not callable’’

File “/var/mycodo-root/mycodo/controllers/controller_conditional.py”, line 181, in check_conditionals
self.conditional_run.conditional_code_run()
File “/home/pi/Mycodo/mycodo/user_python_code/conditional_60f0603e-ae14-43ff-ac1b-97f756d5a833.py”, line 33, in conditional_code_run
if measurement(“2ce36853”) is None:
TypeError: ‘float’ object is not callable
2022-11-26 22:03:57,275 - INFO - mycodo.controllers.controller_conditional_60f0603e - This INFO log entry will appear in the Daemon Log
2022-11-26 22:03:57,396 - INFO - mycodo.controllers.controller_conditional_60f0603e - Measurement value is 408.0
2022-11-26 22:03:57,396 - ERROR - mycodo.controllers.controller_conditional_60f0603e - Exception executing Run Python Code
Traceback (most recent call last):
File “/var/mycodo-root/mycodo/controllers/controller_conditional.py”, line 181, in check_conditionals
self.conditional_run.conditional_code_run()
File “/home/pi/Mycodo/mycodo/user_python_code/conditional_60f0603e-ae14-43ff-ac1b-97f756d5a833.py”, line 33, in conditional_code_run
if measurement(“2ce36853”) is None:
TypeError: ‘float’ object is not callable
2022-11-26 22:04:17,445 - INFO - mycodo.controllers.controller_conditional_60f0603e - This INFO log entry will appear in the Daemon Log
2022-11-26 22:04:17,555 - INFO - mycodo.controllers.controller_conditional_60f0603e - Measurement value is 408.0
2022-11-26 22:04:17,556 - ERROR - mycodo.controllers.controller_conditional_60f0603e - Exception executing Run Python Code
Traceback (most recent call last):
File “/var/mycodo-root/mycodo/controllers/controller_conditional.py”, line 181, in check_conditionals
self.conditional_run.conditional_code_run()
File “/home/pi/Mycodo/mycodo/user_python_code/conditional_60f0603e-ae14-43ff-ac1b-97f756d5a833.py”, line 33, in conditional_code_run
if measurement(“2ce36853”) is None:
TypeError: ‘float’ object is not callable
2022-11-26 22:04:30,830 - INFO - mycodo.controllers.controller_conditional_60f0603e - Deactivated in 159.2 ms
2022-11-26 22:05:03,154 - INFO - mycodo.controllers.controller_input_c5bc31a8 - Deactivated in 21.1 ms
2022-11-26 22:05:06,729 - INFO - mycodo.controllers.controller_input_c5bc31a8 - Activated in 292.5 ms

Parentheses denote a function call and only functions can be called. Float objects cannot return values, and cannot be called. If measurement is a float value, you should be using the condition if measurement is not None.

then if i want to block the valve if is not showing any data by some problem, how i can say block the valve when is None?
i should create another conditionaal controler function?

I’m not sure I understand your question. The original example code is if measurement is not None, which only passes if the measurement is not None. You removed the “not” to pass when the value is None.

then i should create another conditional controller unction with if measuremets is None. true?

i see in the manual a function like this:

# Example 1, no measurement (i.e. None) returned
# useful with the Email Notify Action to email when an Input stops working
if self.condition("asdf1234") is None:
    self.run_all_actions()  # Execute all configured actions