-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Add support of input registers while querying modbus sensor. #7082
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 support of input registers while querying modbus sensor. #7082
Conversation
@LvivEchoes, thanks for your PR! By analyzing the history of the files in this pull request, we identified @persandstrom, @kixam and @fabaff to be potential reviewers. |
Hi @LvivEchoes, It seems you haven't yet signed a CLA. Please do so here. Once you do that we will be able to review and accept this pull request. Thanks! |
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.
See #7082 (comment)
The input register addition is good, but we shouldn't try to convert anything to a float here. There's no Modbus standard, so the encoding varies by application. We should leave that to be layered on top of the sensor entity.
OK Thank you. What is you advices? add only input register to modbus component, and then develop own sensor type, which can decode value to IEEE-754 standard? |
We should get an opinion from @balloob before starting, but these are a few possible approaches:
|
Ok nice. But I would like to add that all Eastron devices http://www.eastrongroup.com/ working in this data type =( |
Now that I'm looking at this more, and see the other options, I think I agree that it probably makes the most sense to perform the conversion in this platform. It's unfortunate that there is no standard, since that means we'll need to expose configuration options for the different encoding variations, but it makes the most sense for this sensor to expose the meaningful value for the device. It's not too different from workaround configs in other platforms. Let's wait for @balloob to decide. |
Hello @armillis. Can we reach @balloob with another way to decide? |
I'll go ahead and make the executive decision that this is OK with the justification posted above. :) It's limited to this platform so it's not too broad. I think we should restructure the config format a bit though to make this a little more future-proof. Instead of CONF_DATA_TYPE = 'data_type'
DATA_TYPE_INT = 'int'
DATA_TYPE_FLOAT = 'float'
...
This will give us room to expand when we encounter other wacky Modbus devices. |
Sorry, have been busy. I'm with @armills 👍 |
Hi @armills. PR updated! |
Thanks for the contribution! 🎉 |
Description:
Add support of modbus input registers query. For now modbus sensor support only holding register, but many devices working can provide data only from input registers. So this PR add support of modbus input registers, and also can process returned value in 32 bit IEEE 754 floating point format.
Added attributes register_type and data_type.
Related issue (if applicable):
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#2423
Example entry for
configuration.yaml
(if applicable):Checklist:
If user exposed functionality or configuration variables are added/changed: