Skip to content

Adding climate.velbus support #18100

Merged
fabaff merged 5 commits intohome-assistant:devfrom
cereal2nd:dev
Nov 2, 2018
Merged

Adding climate.velbus support #18100
fabaff merged 5 commits intohome-assistant:devfrom
cereal2nd:dev

Conversation

@cereal2nd
Copy link
Copy Markdown
Contributor

@cereal2nd cereal2nd commented Nov 1, 2018

Description:

Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#7323

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • New dependencies have been added to the REQUIREMENTS variable ([example][ex-requir]).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.

@ghost ghost assigned fabaff Nov 2, 2018
Copy link
Copy Markdown
Member

@fabaff fabaff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 🐦

@fabaff fabaff merged commit 3fe895c into home-assistant:dev Nov 2, 2018
@ghost ghost removed the in progress label Nov 2, 2018

DEPENDENCIES = ['velbus']

OPERATION_LIST = ['comfort', 'day', 'night', 'safe']
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong. Only states imported from the base climate component is allowed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how we can get all states to work in this case ...3
What do you suggest we use as a mapping?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know the integration or what those modes do, so I don't have a suggestion at the moment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basically those 4 are are all temperature presets

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The home assistant operation state explains how the thermostat tries to adjust temperature, eg heat, cool, auto, eco. It doesn't say what temperature the thermostat should set. We have target_temperature and set_temperature for that.

If I understand correctly 'comfort', 'day', 'night', 'safe' are levels of temperature the thermostat should try to keep? If so, we shouldn't use operation mode in home assistant to change those.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this means i will only have on operation mode in HA (heat)
and how do i handle the temperature levels?

Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare Nov 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can set a specific temperature degree with set_temperature these modes are not required, right? I don't think we currently have any matching control options for these modes. But look at the base climate component features.

@property
def current_operation(self):
"""Return current operation ie. heat, cool, idle."""
return self._module.get_climate_mode()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should return one of the home assistant climate states.


def set_operation_mode(self, operation_mode):
"""Set new target operation mode."""
self._module.set_mode(operation_mode)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to convert from home assistant climate state to device mode and vice versa. Define two constant dicts at the module level that do this.

def set_operation_mode(self, operation_mode):
"""Set new target operation mode."""
self._module.set_mode(operation_mode)
self.schedule_update_ha_state()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this. Let the state update callback update state.

"""Set new target temperatures."""
if kwargs.get(ATTR_TEMPERATURE) is not None:
self._module.set_temp(kwargs.get(ATTR_TEMPERATURE))
self.schedule_update_ha_state()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above.

@balloob
Copy link
Copy Markdown
Member

balloob commented Nov 8, 2018

@MartinHjelmare is right, this platform does not follow our climate entity specification. To avoid a future breaking change, I will remove this and it can be submitted again with the right operation modes.

@balloob balloob mentioned this pull request Nov 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants