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

Add persistent connection connected sensor #3752

Open
Megabytemb opened this issue Aug 3, 2023 · 10 comments
Open

Add persistent connection connected sensor #3752

Megabytemb opened this issue Aug 3, 2023 · 10 comments
Labels
enhancement New feature or request sensor-tracking

Comments

@Megabytemb
Copy link

Megabytemb commented Aug 3, 2023

Is your feature request related to a problem? Please describe.

I'm wanting to be able to remotely manage when the Mobile App will use a Persistant connection.
For changing the persistent connection, i can use the notification command command_persistent_connection
However, there is no sensor that returns what the current persistant connection status is.

Describe the solution you'd like

It would be great to see a binary_sensor that reflects the current persistant connection state.
secondary, but not as critical, it would be good to have a Sensor that reports what the current persistant connection setting is (always, home_wifi, screen_on, never).
Perhaps it could be combined into a Select entity.

Describe alternatives you've considered, if any

there's not really an alternative, as i'm unable to get the state of the connection, or the current setting

Additional context

Furthermore, the command_persistent_connection does seem a bit flakey, and isn't as responsive as i would lik.
I can see the notification appearing in the Notification History in Companion App settings, but the persistant connection doesn't always update, or is very slow to update.

@Megabytemb Megabytemb added the enhancement New feature or request label Aug 3, 2023
@dshokouhi
Copy link
Member

It would be great to see a binary_sensor that reflects the current persistant connection state.

This makes sense

secondary, but not as critical, it would be good to have a Sensor that reports what the current persistant connection setting is (always, home_wifi, screen_on, never).

good point, I would hate to have 2 sensors but it does make sense to show the user that the connection is established and what value is used for its setting.

Perhaps it could be combined into a Select entity.

This would not work with current architecture. The mobile_app integration only supports the device_tracker, sensor and binary_sensor entities.

Furthermore, the command_persistent_connection does seem a bit flakey, and isn't as responsive as i would lik.
I can see the notification appearing in the Notification History in Companion App settings, but the persistant connection doesn't always update, or is very slow to update.

you may need to wait about 30 seconds or so in order for it to turn off as its not constantly checking the parameters but once every 30 seconds

https://github.com/home-assistant/android/blob/master/app/src/main/java/io/homeassistant/companion/android/websocket/WebsocketManager.kt#L114-L116

@Megabytemb

This comment was marked as off-topic.

@dshokouhi
Copy link
Member

@Megabytemb

This comment was marked as off-topic.

@Megabytemb

This comment was marked as off-topic.

@dshokouhi
Copy link
Member

I only have 1 server configured, so settingsDao.get(0) should be fine.\nBut perhaps we should output the ServerID in the troubleshooting logs, and then add an optional param to the command_persistent_connection command where you can nominate the serverID you wish to update, which defaults to 0?

That's a good point but we'd need a better way to communicate the server ID in order to fix the command properly for multi server. To be safe we should probably update the command in the meantime to update the active server when not defined.

@Megabytemb

This comment was marked as off-topic.

@jpelgrom
Copy link
Member

jpelgrom commented Aug 3, 2023

I only have 1 server configured, so settingsDao.get(0) should be fine.

It is not, 0 is never used for servers, only for shared settings.

@jpelgrom
Copy link
Member

jpelgrom commented Aug 3, 2023

where you can nominate the serverID you wish to update, which defaults to 0?

Server IDs are internal and not meant to be exposed, to update the setting for a specific server you'd send the command from that server.

@jpelgrom
Copy link
Member

jpelgrom commented Aug 3, 2023

Fix for the notification command submitted, let's focus this discussion on the sensor request again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request sensor-tracking
Projects
None yet
Development

No branches or pull requests

3 participants