Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Component error: modbus - cannot import name 'Defaults' from 'pymodbus.constants' (/usr/local/lib/python3.11/site-packages/pymodbus/constants.py) #112

Closed
denzelm5 opened this issue Aug 23, 2023 · 13 comments

Comments

@denzelm5
Copy link

Good Day,

Home Assistant 2023.8.3
Supervisor 2023.08.1
Operating System 10.5
Frontend 20230802.1 - latest

Victron Integration : latest

I got this issue this morning :

Updating state for sensor.victron_solarcharger_tracker_2_pv_power_1 (<class 'custom_components.victron.sensor.VictronSensor'>) took 0.726 seconds. Please report it to the custom integration author.
9:08:19 AM – (WARNING) helpers/entity.py
Error while setting up victron platform for number
9:04:52 AM – (ERROR) Number (custom integration)
TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{{ states('sensor.victron_tank_remaining_21')|float() }}' but no default was specified') while processing template 'Template<template=({{ states('sensor.victron_tank_remaining_21')|float() }}) renders=5478>' for attribute '_attr_native_value' in entity 'sensor.jojo_1'
9:04:50 AM – (ERROR) helpers/template_entity.py - message first occurred at 9:04:50 AM and shows up 3 times

Regards

@nicofamdj
Copy link

nicofamdj commented Aug 23, 2023

I can confirm after last update:

Setup failed for modbus: Unable to import component: cannot import name 'Defaults' from 'pymodbus.constants' (/usr/local/lib/python3.11/site-packages/pymodbus/constants.py)

Victron is working, but my modbus in confguration.yaml is not working anymore after update to 0.1.3

After reverting back to 0.1.2 my modbus config is working again (aswell as the victron*)
*) sometimes this error (0.1.2):
Setup failed for custom integration victron: Unable to import component: cannot import name 'make_byte_string' from 'pymodbus.utilities' (/usr/local/lib/python3.11/site-packages/pymodbus/utilities.py)

After rebooting HASS victron (0.1.2) is working again.

@peregrines2
Copy link

peregrines2 commented Aug 23, 2023

Same here :(
After removing "modbus: !include modbus.yaml" in configuration.yaml the error message disappeared and Victron integration is working again.
Unfortunately I really need my modbus.yaml.

@smout74
Copy link

smout74 commented Aug 24, 2023

Unfortunately +1 on the error:

Setup failed for modbus: Unable to import component: cannot import name 'Defaults' from 'pymodbus.constants' (/usr/local/lib/python3.11/site-packages/pymodbus/constants.py)

@wasn-eu
Copy link

wasn-eu commented Aug 25, 2023

same here

uninstalled it with hacs but problem is still there.
all my modbus devices are gone.

please fix it

@wasn-eu
Copy link

wasn-eu commented Aug 25, 2023

my whole system relies on the normal modbus for reading about 20 energy meter
We need a quick fix

@wasn-eu
Copy link

wasn-eu commented Aug 25, 2023

i have forked your repository and changed the pymodbus version to 3.1.1 in manifest.json

after insalling that package with hacs i can use the normal modebus system and victron

@sfstar
Copy link
Owner

sfstar commented Aug 27, 2023

Sorry that i'm unable to quickly patch issues with this integration at the moment.
In case of issues with a new release you can also select redownload integration in hacs and download an older version again until a fix comes out

@smout74
Copy link

smout74 commented Aug 29, 2023

After upgrading to HASS 2023.8.4 and re-installing this version 0.1.3, for me the issue seems to be solved. Both the Victron and normal modbus (Energy kWh meters Hiking via tcp and standard HASS modbus) seem to be working and updating as normal.

It's running like this for 50+ hours, no complaints anymore.

@sfstar
Copy link
Owner

sfstar commented Sep 4, 2023

Please test the beta v0.1.4 release of this interation (this is a copy paste reply which isn't customized for each issue v.0.1.4 is attempting to adres).
Make sure that (in cae this applies to you) the core modbus integration is also fully enabled after bumping to version 0.1.4 and let me know if the issue persists.

@denzelm5
Copy link
Author

denzelm5 commented Sep 5, 2023 via email

@peregrines2
Copy link

peregrines2 commented Sep 5, 2023

Here too :(
After installing the Beta and re-enabling "modbus: !include modbus.yaml"
The system wont restart and gives an error :(

Bildschirmfoto 2023-09-05 um 08 28 02

@peregrines2
Copy link

(after installing the Beta I was able to restart though)

@sfstar
Copy link
Owner

sfstar commented Mar 15, 2024

Later releases adressed the incompatibility between the HA core modbus integrations pymodbus version being used and this integrations pymodbus usage.
Therefore, closing issue for now.
Please re-open if the issue persists.

@sfstar sfstar closed this as completed Mar 15, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants