Skip to content
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

iHarmony Zoning toggle? #160

Closed
smkelly opened this issue May 24, 2022 · 22 comments · Fixed by #163
Closed

iHarmony Zoning toggle? #160

smkelly opened this issue May 24, 2022 · 22 comments · Fixed by #163
Assignees
Labels
enhancement New feature or request
Projects

Comments

@smkelly
Copy link

smkelly commented May 24, 2022

I have a two zone Lennox system, but I don't always have iHarmony zoning activated. Mostly because it takes my variable stage system and seems to turn it into a two stage system.

Any chance there is a way to toggle iHarmony Zoning on/off via a switch entity?

@PeteRager
Copy link
Owner

PeteRager commented May 24, 2022

Sure we should be able to do that. First we’ll need to decipher the command. My system does not do that, so I’ll need your help.

  1. Enable message logging. Go into integration configuration, check the “log messages to file” and enter a file name like s30_message.log. Reload the integration or restart HA for this to take effect.
  2. Once the integration is back up for a few minutes. Enable iHarmony Zoning (note the time), wait a couple of minutes, change the zone temperature setpoint, wait a couple of minutes, disable it, wait a couple of minutes and change the zone temperature setpoint.
  3. Grab the message log (should be in same folder as home assistant log)
  4. Post it here (all personal information is redacted) or email it to me, with the times at which you issued the commands.

In that file we should see the messages that get sent to the integration when the zoning mode is changed, as well as the complete config of your system which I’ll also need. With that information I should be able to determine the messages to send.

The other piece of information needed is if there is any expected behavior change in the current integration. Meaning if the current integration works fine regardless of the zoning mode - that would mean no change. If it’s need to work differently that would be good to know.

Reading the Lennox docs, disabling this makes it a 1 zone system. So when you do this, does Zone 1 become the control point and the other Zones 2,3,4 become not used? If so, should we make Zone 2-4 setpoints unavailable in HA when operating in non zoning mode?

@PeteRager
Copy link
Owner

Updated prior messsge

@PeteRager PeteRager self-assigned this May 24, 2022
@PeteRager PeteRager added the enhancement New feature or request label May 24, 2022
@smkelly
Copy link
Author

smkelly commented May 25, 2022

I did the log capture and there is a lot here. I'm digging through it looking for the actual correct part. Will provide when I have it.

On zoning behavior, you are correct. When iHarmony Zoning is disabled, the entire system becomes a 1 zone system. You can no longer scroll through the zones on the S30 in Zone 1; it only shows itself. The stats in the other zones still show their data, but you cannot adjust heat/cool/setpoints on them. In essence, they become dumb boxes that show the current temperature. So it seems reasonable to hide the mode and setpoints on zones 2,3,4 if zoning is disabled.

Installing the integration was interesting as it showed all of this on the zones even when they are inactive. I had no idea the thermostat even had that data.

Thanks again for your help and quick response. I really appreciate all of your work here.

@smkelly
Copy link
Author

smkelly commented May 25, 2022

s30log.txt

Attached is the captured log with (hopefully) all personal information hidden. Notes at the top on on/off time for iHarmony Zoning.

@PeteRager
Copy link
Owner

PeteRager commented May 25, 2022

Thanks, that is perfect. I have a simulator I can load these messages into.

Looks like it’s that config parameter centralMode that you identified. Should be pretty easy to get that connected to a switch. I’ll start looking at it.


   "messages": [
        {
            "MessageId": 0,
            "SenderID": "**redacted**",
            "TargetID": "homeassistant",
            "MessageType": "PropertyChange",
            "Data": {
                "system": {
                    "config": {
                        "centralMode": true
                    },
                    "publisher": {
                        "publisherName": "remote"
                    }
                }
            }
        }
    ]
} 

@PeteRager
Copy link
Owner

PeteRager commented May 26, 2022

Initial Pull request for API
PeteRager/lennoxs30api#43

@PeteRager PeteRager added this to ToDo in 0.2.8 May 26, 2022
@PeteRager PeteRager moved this from ToDo to InProgress in 0.2.8 May 26, 2022
@PeteRager
Copy link
Owner

I created a project for 0.2.8 that has a set of features related to this one. In that they are all setting elements in that configuration structure. Anyways, probably a week or two away.

@smkelly
Copy link
Author

smkelly commented May 27, 2022

Awesome. Thanks. I'm also happy to test anything. I'm qualified to apply patches, check out commits, or whatever.

Unrelated, ever since I installed this component, my flaky S30 wifi issues have vanished. The thermostat would often be unavailable in the app. I think this probing the S30 enough that it mitigates an undiagnosed wifi issue or something where it was going to sleep, entering a power save state, or who knows what. UniFi UAP-AC-PROs. So that is another benefit to your work. Thanks!

@PeteRager
Copy link
Owner

Sounds good. I’ll need you to do the final test that sending the centralMode command actually works. It should.

That is interesting. Their app has multiple modes of operation and the iOS versions is different than android. One way it works is by talking to the Lennox Cloud Servers, this uses the same REST API / JSON structure that local connection use though different with/URLs. Before we knew the URLs for local, the integration would only work with the cloud connection. And yes, getting the config would often time out (that’s what happens when the app is black), the config are those big messages at the start of the log. The cloud acts as a message relay, so the S30 pull requests down and send stuff out. Lots of steps / infrastructure and opportunity for failures. Restarting the integration was always a gamble. Never thought it was the S30 taking a nap! The iOS app will also connect locally if it’s on your LAN, it uses some very complicated OpenDDS protocol….

@PeteRager
Copy link
Owner

The wifi signal strength appears in the message logs. Looks a little low?


                           "status": {
                                "macAddr": "**redacted**",
                                "ssid": "**redacted**",
                                "ip": "**redacted**",
                                "router": "**redacted**",
                                "networkStatus": "enabled",
                                "channel": 0,
                                "dns": "**redacted**",
                                "dns2": "",
                                "subnetMask": "**redacted**",
                                "bitRate": 58500000,
                                "speed": " 58.5 MBit per second",
                                "rssi": -73
                            },
 

@PeteRager
Copy link
Owner

PeteRager commented May 31, 2022

Question on the implementation.

We want the switch in Home Assistant to have consistent naming and polarity with the Lennox UI. Since I don’t have zoning I can’t see how it works. Do you toggle it on to enable zoning? Or toggle it on to disable zoning?

Description and/or screenshot would be helpful.

@smkelly
Copy link
Author

smkelly commented May 31, 2022

The switch is for zoning being enabled. So, on==zoned, off==central.

Off:
image

On:
image

Re: your observation about wifi signal... I have 3 APs in the house and it prefers to associate with the furthest one away. I had been experimenting with the UniFi controller to force it to associate with the closest one. I was not doing that when I captured this data, so you are seeing the wifi signal for talking to the furthest away AP.

@PeteRager
Copy link
Owner

Thanks for the detailed info and screen shot. Got the initial code of the switch done.

@PeteRager PeteRager linked a pull request Jun 1, 2022 that will close this issue
@smkelly
Copy link
Author

smkelly commented Jun 2, 2022

This throws a traceback on initialization. It does look like I'm running with the required lennoxs30api package:

smkelly@hass ~> docker exec hass pip3 list|grep lennox
lennoxs30api                     0.1.9

The traceback:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 257, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 619, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 810, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 533, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 571, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 539, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1003, in state
    if (is_on := self.is_on) is None:
  File "/config/custom_components/lennoxs30/switch.py", line 403, in is_on
    return self._system.centralMode == False
AttributeError: 'lennox_system' object has no attribute 'centralMode'

This results in the switch being unavailable in HA.

@PeteRager
Copy link
Owner

PeteRager commented Jun 2, 2022

Apologies, my note was not clear. Code is not ready for testing yet. Yes, to get it to run you’d need to grab the updated API. Give me a few more days and I’ll push api 0.1.10 to pypi. If you do want to get it to run, you’d need to get this branch of api - https://github.com/PeteRager/lennoxs30api/tree/0.1.10-dev - it’s version hasn’t been updated so it still,thinks it’s 0.1.9

@PeteRager
Copy link
Owner

Quick update, I have code complete for this an other items for the release. Next step is testing on the simulator, then testing on a live system. Once I get through that - another couple of days - I'll have something ready for you to test.

@PeteRager
Copy link
Owner

PeteRager commented Jun 8, 2022

Here's what it looks like on the simulator:

First screen shot is system in zoned mode. Note all four thermostats are operational. Two new items, the switch to enable zoning (turned on in this pic) and an attribute on the climate entity to report zoning status.

iharmony_zoned

Second, here's what it looks like when I turned zoning off. Switch status updated and the attribute zoning state reports "central". Control of zone 2-4 is disabled, but temperature and humidity are still reported.

iharmony_central

Here's a view of the climate entity details in developers tools when system is in central model. Note the new fields indicating if the zone is enabled and the current system zoning mode.

iharmony_central_attr

I think that covers what is needed?

@smkelly
Copy link
Author

smkelly commented Jun 9, 2022

That looks amazing! Thank you for all of the work on this.

@PeteRager
Copy link
Owner

Merging the pull request auto-closed the issue. I have a pre-release for you to test:

https://github.com/PeteRager/lennoxs30/releases/tag/v0.2.8

This will pull the updated version of the API - v.0.1.10 - this seems to always take a minute or so at HA startup.

There are 2 main items:

  • the switch to control zoning
  • attribute on the climate entity indicating the current zoning mode (zoned or central)

The expected behavior is:

  • controlling the zonings from HA or the Panel should function the same
  • in HA when zoning is turned off, Zones other than Zone 1 should be disabled excepted for reporting temperature.

Main test items:

  • Verify the switch is created to control the zoning Mode
  • Verify the switch is in the correct state.
  • Test toggling the switch from the S30 Panel or the Lennox App
    • The HA switch should follow this state
    • The Climate Zoning Attribute should follow this state
    • Zones other than Zone 1 should be disabled when in "central" mode - except for current temperature/humidity
    • Zone 1 should always function regardless of state
  • Test toggling the switch from HA
    • The S30 Panel should follow this state
    • The Climate Zoning Attribute should follow this state
    • Zones other than Zone 1 should be disabled when in "central" mode - except for current temperature/humidity
    • The physical thermostats should behave the same as they do when toggling the mode from the Lennox Panel / App.
    • Zone 1 should always function regardless of state

Let me know how it goes. I'm going to push the release tomorrow -as it also have some bug fixes. If you have time before then great, if not no worries, we can test in on the release and make changes as needed.

@PeteRager
Copy link
Owner

  • [ ]

@PeteRager PeteRager reopened this Jun 10, 2022
@PeteRager PeteRager moved this from InProgress to Done in 0.2.8 Jun 10, 2022
@smkelly
Copy link
Author

smkelly commented Jun 12, 2022

Testing results:

  • Verify the switch is created to control the zoning Mode: Confirmed
  • Verify the switch is in the correct state: Confirmed
  • Test toggling the switch from the S30 Panel or the Lennox App
    • The HA switch should follow this state: Confirmed
    • The Climate Zoning Attribute should follow this state: Confirmed
    • Zones other than Zone 1 should be disabled when in "central" mode - except for current temperature/humidity: Confirmed
    • Zone 1 should always function regardless of state: Confirmed
  • Test toggling the switch from HA
    • The S30 Panel should follow this state: Confirmed
    • The Climate Zoning Attribute should follow this state: Confirmed
    • Zones other than Zone 1 should be disabled when in "central" mode - except for current temperature/humidity: Confirmed
    • The physical thermostats should behave the same as they do when toggling the mode from the Lennox Panel / App: Confirmed
    • Zone 1 should always function regardless of state: Confirmed

Not only is this working perfectly, you provided some very thorough testing. This is some top notch work. Thank you so much for adding this feature. I really appreciate it and already have automations to control zoned/central for my house.

@PeteRager
Copy link
Owner

Excellent, thanks for the testing.

The unit testing (pytest) is instrumental in the quality. There are more new lines of unit test, than code.

The API contains an S30 simulator, which aids in system testing, so for this I set it up to send the messages you had captured.

Anyways enjoy the feature, good working with you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
0.2.8
Done
Development

Successfully merging a pull request may close this issue.

2 participants