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

Possibility to show and set smarthome mode? #153

Open
Linqman opened this issue Sep 16, 2024 · 18 comments
Open

Possibility to show and set smarthome mode? #153

Linqman opened this issue Sep 16, 2024 · 18 comments

Comments

@Linqman
Copy link

Linqman commented Sep 16, 2024

Hi, and thank you for your work on this integration!

I have a question regarding the getting and setting of smart home mode for my F750, is this something that is supported?
On the public API swagger, you can query the current mode, and also set it, but I can't seem to find the setting in home assistant.
GET /v2/systems/{systemId}/smart-home-mode

@jaroschek
Copy link
Owner

jaroschek commented Sep 18, 2024

@Linqman The smart home mode is currently not supported in this integration.

But to be honest, I am already working on it...

I just have some issues working with it. There is a schema definition of the available values, that would lead to a select entity:
smart home mode schema definition

But not all defined options seem to be valid values for the PUT request:
failed to put 'Home'

What values are you able to PUT there? Which values would be acceptable? Or are the possible values related to the users system(s)/device(s)?

Unfortunately this is another example of the bad implementation/usage of the myUplink API besides missing and wrong parameter definitions like false writable and others.

@jaroschek
Copy link
Owner

From the 5 defined options I can only use 3 effectively:

  • Default is accepted and sets the value to Normal
  • Normal is accepted and sets the value to Normal
  • Away is accepted and sets the value to Away
  • Vacation is accepted but ignored as it does not change the value
  • Home is not accepted at all

@Linqman
Copy link
Author

Linqman commented Sep 18, 2024

I had a similar experience when testing last time, I only got it to Away mode, but nothing after that. However, now when I tested I got i set to Vacation, but nothing else after that.

If I remember correctly from the NibeUplink API, the smart home mode worked so that when selecting the modes "Away" or "Vacation" (I just used "Vacation"). What it actually did was set the mode, and after about an hour (I don't remember the specific duration), it reverted back to Home/Default/Normal mode.

But if you called the API again, it would restart the internal timer, and keep the system in vacation mode for another hour. To actually use this, I had an automation that updated the vacation mode in Nibe every half-an-hour when a vacationmode boolean was set to true. And when you wanted to get out of vacation mode, you just stopped setting it, and it would revert in a maximum of an hour.

So I guess it works the same here, and if I would guess about the reasons for why, it might be that in case the internet connection dies while in away mode, it won't get stuck in that.

But I agree with you that there's no explanation for this behaviour.

@jaroschek
Copy link
Owner

Ok, sounds like an experiment. Knowing of this previous behaviour I decided to give it a try.

I have created a new pre-release that you can test and check if it works for you:
https://github.com/jaroschek/home-assistant-myuplink/releases/tag/1.4.0-rc1

@Linqman
Copy link
Author

Linqman commented Sep 18, 2024

Thanks! I'll test it out right away!

@Linqman
Copy link
Author

Linqman commented Sep 18, 2024

Hi, the smart home mode just shows up as unavailable:
image

@jaroschek
Copy link
Owner

jaroschek commented Sep 18, 2024

How many devices do you have in your myuplink system? And is this device connected?

If you have only a single device in the system, the smart home mode entity will only be available if the device is connected.

I tried to set the value while the device was disconnected and got an error in response because of the disconnected device.

@Linqman
Copy link
Author

Linqman commented Sep 18, 2024 via email

@jaroschek
Copy link
Owner

Can you please show the current response from GET /v2/systems/{systemId}/smart-home-mode?

@Linqman
Copy link
Author

Linqman commented Sep 18, 2024

image

@jaroschek
Copy link
Owner

Thank you! It looks the same like my response.

Did you restart your Home Assistant completely?

@Linqman
Copy link
Author

Linqman commented Sep 18, 2024

Actually now the smart home mode has shown up, and yes I did restart it after installing the new version. I'll check to see if I can see when it got the statuses.

@Linqman
Copy link
Author

Linqman commented Sep 18, 2024

I tried setting the Smart Home Mode to Vacation, which worked, my heatpump went into vacation mode. But after that, presumably on next reading of data, all entities went to unavailable. Then the next minute, presumably next reading of data, the entities again had values, but the smart home mode showed "Normal", even though the heat pump was still on vacation mode.

The problem with the wrong state of smart home mode seems to be the API. I checked and the API returns status "Normal" even though the heatpump shows vacation mode.

@Linqman
Copy link
Author

Linqman commented Sep 18, 2024

I did some more testing. It appears the heatpump reacts immediately to the set smart home status calls, but the get smart home status lags behind. Here's what I tried and observed

21:00 set to Default -> heatpump immediately updated
21:01 Smart Home Mode changed to Normal
21:03 set to Vacation -> heatpump immediately updated
21:15 Smart Home Mode changed to Vacation
21:16 set to Normal -> heatpump immediately updated (smart home mode shows Vacation)
21:19 set to Away -> heatpump immediately updated (smart home mode shows Vacation)
21:20 set to Normal -> heatpump immediately updated (smart home mode shows Vacation)
21:32 Smart Home Mode changed to Normal

@jaroschek
Copy link
Owner

jaroschek commented Sep 19, 2024

Do you still have the problem with the temporarily unavailable entities? If so can you check the connection state entity of the device? If the device is (temporarily) disconnected, you could activate the config option Keep disconnected parameters available?.

Regarding the lag in the API there is nothing I can do. Or does the API return the correct value immediately but the Integration in Home Assistant lags?

@Linqman
Copy link
Author

Linqman commented Sep 19, 2024

No, the entities have not gone unavailable now.

Yeah, I know you can't affect the API, it is the API that reports the old status. It actually seems to update 4 times an hour, and at least these two days, it seems to happen at the same minutes of each hour.

Could be a possibility to change the implementation so that one entity would just be an option to set the mode, and another one would display the value from the API.

@jaroschek
Copy link
Owner

No, the entities have not gone unavailable now.

Great!

Could be a possibility to change the implementation so that one entity would just be an option to set the mode, and another one would display the value from the API.

This would be complicated. For example what should happen If someone changes the smart home mode outside of Home Assistant? In such a case both entities would have to be updated to show the new state.

Currently I would make one step after the other and finalize this release in the way it is implemented now. (Hopefully myUplink is working to mat the API more reliable.)

@Linqman
Copy link
Author

Linqman commented Sep 20, 2024

I now enabled the "Keep disconnected parameters available" setting, as the connection state also indicates it once in a while gets disconnected:
image

Yes it would of course be more complicated, but my thought was that you would have a "Set smart home mode" entity (or service) that just sets the mode, never updates with the status of the smart home mode. Then another one "Reported smart home status" or something, that would update whenever the API actually updates.

I think it might be some API call throttling that causes the connection to get disconnected. When testing the mode changes while standing beside my heatpump, I got it to disconnect several times when changing smart home modes, and I suspect this happens when you happen to change the mode through the API close enough to the previous calls to the API.

image

And btw., this current implementation is all I need and I'm very grateful for it. I'm just testing to try and understand how their API works. I also asked Nibe but they said they have no support for the open API :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants