Harmony Hub Climate Component for A/C integration

Hi all,

This is my custom component to control air conditioners through a harmony hub. Since its a climate component, it appears in Home Assistant as any other climate component.

Details on how to setup in the readme.

thermostat_harmony

3 Likes

I love it, thank you!!
Having issues with 0.84 though, specifically with async_get_last_state, had to comment out the state retreival.

def async_added_to_hass(self):
  #state = yield from async_get_last_state(self.hass, self.entity_id)
  return
#        if not state:
#            return
#        if state is not None:
#            self._target_temperature = state.attributes['temperature']
#            self._current_operation = state.attributes['operation_mode']
#            self._current_fan_mode = state.attributes['fan_mode']```

Good to see someone else is using this :slightly_smiling_face:
I made a fix for HA 0.84. Download from the dev branch on my githib. I’ll be merging this to master branch if there are no issues
https://github.com/so3n/HA_harmony_climate_component/tree/dev

Works like a charm. Tested state retrieval, sending commands, homekit integration, I am using Harmony to control 2 air conditioners. No issues in the log. Let me know if I can help further with testing.
Thank you!

what is the fix for this? i also had to comment out this line in a custom component

see here

Here’s the diff https://github.com/so3n/HA_harmony_climate_component/commit/c1314cd09da9ab702eb2bbee4e0d78bd92c71864#diff-a389dfcff4636d14d55b0d3e61e74f46

All kudos go to @so3n

@dnikolov @so3n

do you know whats needs to be changed in this file?


thnx in advance

I would file an issue to the original author of the file, https://github.com/gieljnssns/My-Hassio-config/blob/master/config/custom_components/sensor/kostal.py , let’s stick to the Harmony Hub Climate here.

Should we expect this to be broken by the HarmonyHub Gate (and transition to WebSockets in the latest branch) ? I’ve blocked Harmony’s internet access so it works well for me right now, but don’t want to lose the thermostats over Logitec’s stupidity.

Yes its stopped working for me :frowning:
I’ll review what changes were made to the remote.harmony component and incorporate that to this

I have now updated to use web sockets so this still works if Harmony was updated to latest firmware.

I will test and give back in the morning. Thank you so much for sharing the effort!

So according to this we can opt in to enable XMPP api firmware with Logitech which I have done myself.

It is looking like Home Assistant will be recommending this option and after the holidays will update the main harmony component to use the old API method over websocket.

So I have updated this component back to the XMPP api (which will only work with XMPP firmware). If you would like to use the websocket version I’ve kept it in the websocket_api branch

1 Like

What a mess! I was away from home for a week or so, yesterday came back and rebooted the router, somehow my firewall rule that blocked HHub from accessing the internet disappeared and this morning I was surprised that I am on the new firmware. Started upgrading HA and was about to install the websocket version, then read your post (thanks for that, I thought that they are going to release that in January), switched to dev firmware and rolled back to 0.84.1 - everything worked like a charm.
Another report (and let me know if you prefer these in GitHub) - i was trying to include CLIMATE.TURN_ON and CLIMATE.TURN_OFF in an automation, but was getting “Not implemented error”. My use case is the following - I have a Xiaomi cube and want my wife to be able to turn the AC on to the last HA state (instead of turning on to heat or cool). My current workaround is to turn it on by setting to heat, but would be nice to turn it to the last setting.

trigger:
  - platform: event
    event_type: xiaomi_aqara.cube_action
    event_data:
      entity_id: binary_sensor.cube
      action_type: shake_air
condition:
  condition: template
  value_template: '{{ is_state("climate.bedroom", "off") }}'
action:
  - service: climate.set_operation_mode
    data_template:
      entity_id: climate.bedroom
      operation_mode: heat

Yes I came across the climate.turn_on / climate_turn_off service calls not working in my automations.

I’m not entirely sure how to implement this, and it’s the same situation from the broadlink climate component I forked from.

I might see if I can figure out how official HA climate components are doing this, however I am a python novice. PR’s are welcome if you have ideas :slight_smile:

I am total noob when it comes to programming. Pasted the following inside the harmony.py

    async def async_turn_on(self):
        """Turn thermostat on."""
        await self.async_set_operation_mode(self.operation_list[0])

    async def async_turn_off(self):
        """Turn thermostat off."""
        await self.async_set_operation_mode(STATE_OFF)

but both turn_on and turn_off are turning the AC off. The generic thermostat only supports either heating or cooling. My guess was that I could use a variable to store the last non-off state and pass it to await self.async_set_operation_mode, but ran out of skills there :frowning:

Thanks for that.

Just had a look…self.operation_list[0] will depend on the order of your operations list in configuration.yaml under customize:

self.operation_list[0] will use the 1st one in the list, self.operation_list[1] will use the 2nd one in the list, etc.

At minimum I think this should default to the 1st one in the list that is not ‘off’?

Did you want to lodge an issue on github?

I can’t seem to find a way to create a pull request to the repo, I am a total noob. Anyway, here’s what I got (and again, obviously, I have no programming background)


Basically, added a last_operation property which should be changed once you change the operation to a non-idle one, it is then saved and passed to the turn_on.
I see your idea to just shuffle the list, but I think that was a workaround for the GenericThermostat where they only do have either [Heat, Off] or [Cool, Off], and it doesn’t quite solve my use case.

Cool thanks :slightly_smiling_face:
Does this code work how you want?

If you click the fork button (top right) on my repo, commit the changes to your fork, then go back to my repo and you click the pull request tab, you should be able to put through a PR from your fork to my dev branch.

Cool, thanks for your help. Created the PR and explained further there, but yes, tested it and it works for me.

1 Like