Update docstrings and log messages#7709
Merged
Merged
Conversation
azogue
reviewed
May 22, 2017
Member
There was a problem hiding this comment.
@fabaff, I don't know if you have seen that:
In _get_message_data lies a KeyError when receiving callback queries (introduced in #7689). The chat info is not present there.
You could change it to something like:
if msg_data['from'].get('id') not in self.allowed_chat_ids \
or ('chat' in msg_data
and msg_data['chat'].get('id')
not in self.allowed_chat_ids):
# Origin is not allowed.
_LOGGER.error("Incoming message is not allowed (%s)", msg_data)
return True, None
data = {
ATTR_USER_ID: msg_data['from']['id'],
ATTR_FROM_FIRST: msg_data['from']['first_name'],
ATTR_FROM_LAST: msg_data['from']['last_name']
}
if 'chat' in msg_data:
data[ATTR_CHAT_ID] = msg_data['chat']['id']
return True, dataOr, if wanted, I could do another PR...
Member
Member
Member
Author
|
Thanks guys |
MartinHjelmare
approved these changes
May 26, 2017
Merged
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description:
Modify rendering of attributes (see comment by @azogue).
Related issue (if applicable): fixes #7705, fixes #7703
Example entry for
configuration.yaml(if applicable):Content for "Service Data" to use in "Call Service". For #7705:
{ "title": "Test images", "message": "The sun is {% if is_state('sun.sun', 'above_horizon') %}up{% else %}down{% endif %}!", "data": { "photo": { "url": "https://home-assistant.io/images/supported_brands/influxdb.png" } } }For #7703:
{ "title": "Test location", "message": "The sun is {% if is_state('sun.sun', 'above_horizon') %}up{% else %}down{% endif %}!", "data": { "location": { "latitude": 32.87336, "longitude": 117.22743 } } }Checklist:
If the code communicates with devices, web services, or third-party tools:
toxrun successfully. Your PR cannot be merged unless tests pass