Mqtt cover modifications#7841
Conversation
removing command_topic being required
|
@cribbstechnologies, thanks for your PR! By analyzing the history of the files in this pull request, we identified @pvizeli, @turbokongen and @balloob to be potential reviewers. |
| } | ||
| })) | ||
|
|
||
| state_attributes_dict = self.hass.states.get( |
There was a problem hiding this comment.
local variable 'state_attributes_dict' is assigned to but never used
| } | ||
| })) | ||
|
|
||
| state_attributes_dict = self.hass.states.get( |
There was a problem hiding this comment.
local variable 'state_attributes_dict' is assigned to but never used
| self.mock_publish.mock_calls[-2][1]) | ||
|
|
||
|
|
||
| def test_no_command_topic(self): |
| current_cover_position = self.hass.states.get( | ||
| 'cover.test').attributes['current_position'] | ||
| self.assertEqual(22, current_cover_position) | ||
|
|
|
Hey @balloob. Sorry for the direct tag. Anyway this can make it into 0.46? Would be clutch to have it out in the next release cycle. Me and @cribbstechnologies worked through my typos and I'm good to share my project soon. |
|
Will it be possible to set the position with a customized json payload, e.g. like: set_position_template: '{"covers": [1,2],"position" : value.position}' |
emlove
left a comment
There was a problem hiding this comment.
I really like the method of passing the service call through a template. It gives great flexibility to handle scaling or whatever else the endpoint might need.
| self._position_topic = position_topic | ||
| self._set_position_template = set_position_template | ||
| if set_position_template is not None: | ||
| self._set_position_template.hass = hass |
There was a problem hiding this comment.
Can you put this logic in async_setup_platform so we don't need to pass hass in? Let's make it look the same as value_template.
| if self._position_topic is not None: | ||
| supported_features |= SUPPORT_SET_POSITION | ||
|
|
||
| if self.current_cover_position is not None: |
There was a problem hiding this comment.
I think this should now be removed since we're using self._position_topic to define SUPPORT_SET_POSITION. It probably shouldn't have been set before.
There was a problem hiding this comment.
Did you mean remove the block starting at line 262?
| position = kwargs[ATTR_POSITION] | ||
| if self._set_position_template is not None: | ||
| try: | ||
| position = self._set_position_template.async_render() |
There was a problem hiding this comment.
Change this to async_render(**kwargs). This will make the requested position from the service available to the template. Should also be noted in the docs.
emlove
left a comment
There was a problem hiding this comment.
LGTM, except the polymer submodule update needs to be removed.
This reverts commit 9cfc5ed.
|
I think I reverted it. Let me know if I didn't do it right.
…On Wed, May 31, 2017 at 11:19 AM, Adam Mills ***@***.***> wrote:
***@***.**** approved this pull request.
LGTM, except the polymer submodule update needs to be removed.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7841 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABjyfUX-fCr8LZxR7wiY6ie6aMdLI1m0ks5r_YUXgaJpZM4Nq626>
.
|
|
@armills if you approve, you can merge it too in the future 👍 Sorry, didn't make 0.46 as I am not really paying attention to notifications anymore (too many). |
|
No worries! I'm trying out a new 12v stepper right now since I have the extra time. Should be a good video once I have everything ready. Thanks much for everyone's work getting the MQTT tilt component integrated! |
|
Untill it gets into the released version, will it then be enough to copy the modified cover/mqtt.py file into the custom component library? |
* adding set position ability removing command_topic being required * flaking * flaking test * updating docs * requested updates * Revert "updating docs" This reverts commit 9cfc5ed. * forgot to update constructor calls in tests
|
Will cherry-pick it for 0.46.1 |
|
Can anyone guide me in the right direction setting this mqtt cover up. {"covers": [1,2],"position" : 50} How is this done, using the latest template feature? |
Description:
Making command topic optional so a tilt-only cover doesn't show up/down controls
Adding ability to set up/down position including ability to template the value
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#2729
**also has modifications for polymer project - PR not ready yet
Example entry for
configuration.yaml(if applicable):Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code does not interact with devices:
toxrun successfully. Your PR cannot be merged unless tests pass