Custom Input: modbus

Hello everyone!
I’ve been trying to use Mycodo and I have a couple of questions.
First question about the Raspberry Pi model - I used Raspberry Pi Zero to deploy Mycodo. README allows any version:

(any version: Zero, 1, 2, 3, or 4).

It seems a bad decision because the interaction with Mycodo is very slow. Several pages are loads about 5 minutes and periodically 50x errors just return. I believe I have good connection and SD card.

Is Mycodo tested in the Zero model? If this is expected behavior - maybe we should exclude Raspberry Pi Zero from requirements? Because it doesn’t work as expected.

Second question is about custom input. I want to write modules to interraction with modbus sensors, using pymodbus dependence. I wrote something like

my code

measurements_dict = {
0: {
‘measurement’: ‘temperature’,
‘unit’: ‘C’,
},
# 1: {
# ‘measurement’: ‘humidity’,
# ‘unit’: ‘percent’
# },
# 2: {
# ‘measurement’: ‘dewpoint’,
# ‘unit’: ‘C’
# }
}

INPUT_INFORMATION = {
‘input_name_unique’: ‘modbusSHT21’,
‘input_manufacturer’: ‘later’,
‘input_name’: ‘ModbusRTUSHT21’,
‘input_library’: ‘pymodbus’,
‘measurements_name’: ‘Temperature’,
‘measurements_dict’: measurements_dict,
‘url_manufacturer’: ‘later’,
‘url_datasheet’: ‘later’,
‘url_product_purchase’: ‘later’,

'dependencies_module': [
    ('pip-pypi', 'pymodbus', 'pymodbus==2.5.3'),
],

'interfaces': ['UART'],
'uart_location': '/dev/ttyAMA0',
'uart_baud_rate': 9600,

'period': 15,  # Float

'options_enabled': [
    'uart_location',
    'period',
    'uart_baud_rate',
    'measurements_select',
    'pre_output',
],
'options_disabled': ['interface']

}

When I upload my modbus module I see


and
could not import pymodbus in WEB logs.

How I can debug what is wrong with my INPUT_INFORAMATION? Could we show the reason of why the upload did fails to reach user can fix it?

Thank you!

All Pi versions are supported but speed will vary. Typical Pi Zero page load times are between 2 and 10 seconds.
Please attach the module you are attempting to import rather than trying to paste the code in-line.

Thanks for quick reply!
Here’s a link to the custom input module that wanted to upload to Mycodo.

Try putting the dependency imports in initialize_input(). I suspect there’s an exception occurring trying to import it because they haven’t yet been installed when the module is attempting to load.

Also, you can drag files into the composition box to attach here. It’s often better to do it this way so future readers don’t have to deal with potentially dead links.

Thank you! It solved the problem. Also didn’t understand the reason but no more freezes.
Thank you for this project!

1 Like