-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
Unpacking RESTful sensor JSON results into attributes. #10753
Merged
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
dbaa626
Added support for extracting JSON attributes from RESTful values
nickovs fb19f87
Added support for extracting JSON attributes from RESTful values
nickovs 0cb9def
Merge branch 'rest-json-attrs' of https://github.com/nickovs/home-ass…
nickovs e08f649
Added requirement that RESTful JSON results used as attributes must be
nickovs de07ae5
Expanded test coverage to test REFTful JSON attributes with and
nickovs 227a5ad
Added support for extracting JSON attributes from RESTful values
nickovs 769c7ff
Added requirement that RESTful JSON results used as attributes must be
nickovs 0f25f6d
Expanded test coverage to test REFTful JSON attributes with and
nickovs a22a6d4
Merge branch 'rest-json-attrs' of github.com:nickovs/home-assistant i…
nickovs 6bd57cc
sensor.envirophat: add missing requirement (#7451)
imrehg d635e26
PyPI Openzwave (#7415)
JshWright 44cc762
Add datadog component (#7158)
nunofgs 67e8f52
Fix object type for default KNX port
JshWright d23ccce
Added support for extracting JSON attributes from RESTful values
nickovs f5bbf6b
Added requirement that RESTful JSON results used as attributes must be
nickovs a281132
Expanded test coverage to test REFTful JSON attributes with and
nickovs dda455d
Added support for extracting JSON attributes from RESTful values
nickovs 3a99f4e
Added requirement that RESTful JSON results used as attributes must be
nickovs 22bc0fc
Expanded test coverage to test REFTful JSON attributes with and
nickovs d19a81b
Added support for extracting JSON attributes from RESTful values
nickovs 4ef54a1
Added requirement that RESTful JSON results used as attributes must be
nickovs 0b9711c
Expanded test coverage to test REFTful JSON attributes with and
nickovs 8c5548e
Merge branch 'rest-json-attrs' of github.com:nickovs/home-assistant i…
nickovs 0795823
Brought up to date with most recent upstream master
nickovs 19eab69
Fixed breaks cause by manual upstream merge.
nickovs 9dd2a5a
Added one extra blank line to make PyLint happy.
nickovs 2dbcff5
Switched json_attributes to be a list of keys rather than a boolean.
nickovs 1d36270
Added an explicit default value to the json_attributes config entry.
nickovs 02158b0
Removed self.update() from __init__() body.
nickovs a537b45
Merge branch 'rest-json-attrs' of github.com:nickovs/home-assistant i…
nickovs 3a9650c
Expended unit tests for error cases of json_attributes processing.
nickovs 0bf5ea3
Align quotes
fabaff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Switched json_attributes to be a list of keys rather than a boolean.
The value of json_attributes can now be either a comma sepaated list of key names or a YAML list of key names. Only matching keys in a retuned JSON dictionary will be mapped to sensor attributes. Updated test cases to handle json_attributes being a list. Also fixed two minor issues arrising from manual merge with 0.58 master.
- Loading branch information
commit 2dbcff5259e0703255e46e7ed3e3b6f962d875e0
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
According to your docs the default is an empty list (->
default=[]
). To be in sync with other platform we should only accept a list and not a comma-separated string ->vol.Optional(CONF_JSON_ATTRS): vol.All(cv.ensure_list, [cv.string]),
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.
I've added the default (although the existing code treats the a value of
None
the same as an empty list).Regarding the use of
cv.ensure_list_csv
, is this function deprecated? The function seems to be there explicitly to allow users to enter lists either as a YAML list or as a CVS list, which is very helpful to users and allows them to choose the representation that they find most readable and compact. The function gets used by calendar/todoist.py, insteon_plm, sensor/mvglive.py and switch/rpi_rf.py and serves a very useful purpose. If the intention is to do way with this useful capability then I can remove it from here but if the function is going to stay around is there really a compelling reason not to use it?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.
No, it's not deprecated and was introduced for the customizing part. I was wrong...it works for all possible ways:
But I still would prefer if we don't promote
a, b, c
because it will lead to confusion for users which are not that familiar with YAML and are looking at other components/platforms.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.
Great. The documentation pull request that I submitted uses option
d
for the example but I'm happy to document it with whichever form you think should be promoted.