-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix monitoring of functions #2826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
janiversen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one seems wrong.
| else "" | ||
| ) | ||
| function_codes += f"<option value={function.function_code} {selected}>function code name</option>" | ||
| function_codes += f"<option value={function} {selected}>function code name</option>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong, you are now building a list of object pointers and not function codes !
| selected = ( | ||
| "selected" | ||
| if function.function_code == self.call_monitor.function | ||
| if function == self.call_monitor.function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems wrong, it is a list of function codes, not object pointers.
|
You have to look at the surrounding context. pymodbus/pymodbus/pdu/decoders.py Lines 34 to 36 in 431fb6c
pymodbus/pymodbus/server/simulator/http_server.py Lines 372 to 378 in 431fb6c
Perhaps something like the code below was the intention? Although I don't really see the advantage over my first code. for function in DecodePDU(True).pdu_table.values():
req_func, _res_func = function
selected = (
"selected"
if req_func.function_code == self.call_monitor.function
else ""
)
function_codes += f"<option value={req_func.function_code} {selected}>function code name</option>" |
Caught by
pyright:)