cdpuk / ha-bestway

Home Assistant integration for Bestway / Lay-Z-Spa hot tubs
MIT License
59 stars 15 forks source link

Support for pool filter pump devices #24

Closed phretor closed 1 year ago

phretor commented 1 year ago

This should resolve #23

cdpuk commented 1 year ago

Thanks for working out the protocol. This is closely related to #16 so I'll try to take ideas from both in order to come up with something that can scale better as more products and different protocols get released.

I can only see the updates to bestway.py in the request. Is there a bunch of other changes missing?

phretor commented 1 year ago

Nope. I changed just that.

On Thu, 15 Jun 2023 at 23:22 cdpuk @.***> wrote:

Thanks for working out the protocol. This is closely related to #16 https://github.com/cdpuk/ha-bestway/issues/16 so I'll try to take ideas from both in order to come up with something that can scale better as more products and different protocols get released.

I can only see the updates to bestway.py in the request. Is there a bunch of other changes missing?

— Reply to this email directly, view it on GitHub https://github.com/cdpuk/ha-bestway/pull/24#issuecomment-1593740399, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABPCNB4M25NIWRADRCWXYDXLN4LHANCNFSM6AAAAAAZIK6SBI . You are receiving this because you authored the thread.Message ID: @.***>

phretor commented 1 year ago

Merged with https://github.com/cdpuk/ha-bestway/tree/generic-bestway

phretor commented 1 year ago

@cdpuk I fixed a couple of things in api.py and limited the number range to 24 hours. The PoolFilterChangeRequiredSensor doesn't show up among the entities. Any ideas why?

image

Also, if I use the native Bestway app to change the device's state, the change isn't reflected in the HA component. Is there a polling loop we should activate somewhere?

cdpuk commented 1 year ago

Thanks for the updates and test. A few more questions:

In other news:

Data is polled from the API every 30s. Changes from the app or device itself should be reflected, but by experimentation this can take a few minutes with my Lay-Z-Spa.

phretor commented 1 year ago
  • Can you make the API return any other values than "运行中" / "running" for the status property. The fact it's a string and not a boolean suggests other values might be possible. At the moment it's forced to a boolean in the integration but that doesn't feel right.

已停止 / "stopped" is when the unit is not filtering

  • Is the error property always present but typically with a null value? Unless you have any idea what errors look like, I might also force this to a binary_sensor for now.

It's always present with a 0 value when not in error state, but I know there are error codes, so we better assume it's an int

  • What's the binary_sensor.spa_errors entity doing in your screenshot? Unless you have an Airjet spa too, it shouldn't be there.

Indeed strange. I removed and re-added the integration, but it came back.

In other news:

  • PoolFilterChangeRequiredSensor should be fixed

I still don't see it.

  • An error sensor for the pool filter has been added based on the simple binary interpretation of error as above.
  • The generic-bestway branch has been updated to incorporate all this, and more.

Data is polled from the API every 30s. Changes from the app or device itself should be reflected, but by experimentation this can take a few minutes with my Lay-Z-Spa.

cdpuk commented 1 year ago

I've made one more change to expose the connectivity sensor, but that shouldn't affect the other entities you're having trouble with.

I spun up a mock API to see what I get, and it all looks correct: image

Perhaps you could remove the integration and also remove all related entities so you get a clean start when re-adding it? I simply binned my configuration since this is all on a dev instance.

Unless anything else comes up, I'll look to publish this shortly.

phretor commented 1 year ago

Nice. I'll try re-adding once you publish, because I've tried already several times with my fork but without luck.

Out of curiosity: what's your development environment and cycle? I used to keep editing the files under the custom_components folder until I reached something functional, and ad that point I rsync-ed back to the repo checkout to add to my fork. That works, but sounds very clumsy. Wondering if there's a more streamlined way.

cdpuk commented 1 year ago

It's slightly unhelpful that we're working on different branches in this case, but that's simply because I had a more mature base branch on which to integrate your changes specific to the pool filter controls.

I work within a devcontainer so a completely isolated HA instance and easy to manage the code.

I'm going to close this one as #31 contains what I've tested.