Skip to content
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

Add Convertion Option to Simple-Connection #10

Open
BoergeSt opened this issue Jul 2, 2022 · 4 comments
Open

Add Convertion Option to Simple-Connection #10

BoergeSt opened this issue Jul 2, 2022 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@BoergeSt
Copy link
Member

BoergeSt commented Jul 2, 2022

Implement Type convertion to simple-connection (or connections in general?) to at least

  • int
  • float
  • string
  • auto? (try int, then float, otherwise don't change)
  • none (default, don't convert)
@BoergeSt BoergeSt added enhancement New feature or request good first issue Good for newcomers labels Jul 2, 2022
@glunkad
Copy link

glunkad commented Jul 3, 2022

Hey @BoergeSt , I'm interested in contributing to this issue, so before I start working on it, would you mind sparing your time explaining what the issue is about and pointing me to some resources to get started .

@BoergeSt
Copy link
Member Author

BoergeSt commented Jul 3, 2022

Hi @9gl
first of all, thanks for reaching out! I have to admit, i am positively surprised, that someone already wants to contribute to this project, as I haven't even had the time to write a proper readme. I will write a short introduction into what this projekt is about and it's intended use-case until today evening (CET). Thereafter, I will explain this issue in more detail.

@BoergeSt
Copy link
Member Author

BoergeSt commented Jul 3, 2022

Good Evening @9gl,
I have now written a (very) basic read-me to get you and anyone else who is interested started.

The reason behind this issue is the following:
Different Protocolls use numbers differently (e.g. modbus uses integers, and floats, while MQTT mostly uses stings. ) Therefore it might be usefull to be able to convert the datatype during the processing of a connection into a target type.

Therefore I would suggest adding an additional setting with named "convertion" with default "None" or something simmilar, which can be set to int, float, decimal or string,... . and then converting the input values previously to the calculations of offsett/factor. Furthermore an convertionOptions parameter might be usefull to specify floor/ceil/round for ->int convertion or the format-string for ->string convertion.

I think, for this you will mainly have to add to the code in the "execute" function of the "SimpleConnection" class within the "AutomationOne.py" file. (Don't be afraid by the long file, it is relatively well structured and will (hopefully) soon be split into proper short files => #4 )

Please don't hesitate to ask any follow-up questions, if you have any :)

@BoergeSt
Copy link
Member Author

BoergeSt commented Jul 8, 2022

I think it makes more sense to make a new connection-type for this, which can be later included/converted into compund-connections #22 since this gives the most flexibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants