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

Added feature to switch to remote vcontrold #10

Merged
merged 3 commits into from Jan 24, 2023

Conversation

Schm1tz1
Copy link
Contributor

Added feature to switch to remote vcontrold instead of running it locally. Uses a config flag and host/port for connection with defaults to localhost:3002, see #9

…ally. Uses a config flag and host/port for connection with defaults to localhost:3002.
@@ -18,9 +18,13 @@ else
export MQTT_PASSWORD=$(bashio::services mqtt "password")
export MQTT_TOPIC="openv"

export VCONTROL_HOST=$(bashio::config 'vcontrol_host')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid misunderstandings when remote_vcontrol is set to false, we should force the host/port to localhost. What do you think ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's even better, but only if you can deactivate them in the config UI IMHO (like adding a ?)
I would avoid forcing values in the script without being able to deactivate them for the end user so one is not confused and inputs are not in conflict with the actual values that are used to run the service.
If this is not possible we can still rename the config flag and explain - e.g. using a flag "start local vcontrold". Will test it later.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about turning it around? If vcontrol_host/vcontrol_port is set, then it is assumed that it's a remote vcontrold.
If it's unset - the vcontrold is started and localhost:3002 is used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, also a good idea. How about this: We remove the remote-switch, set defaults to null (hidden under advanced options) and assume local vcontrold on localhost:3002 in case there is no value set?
That way we stay backwards-compatible and have the same look-and-feel in the configs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will push a test version later today/tonight once I have tested it locally.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Schm1tz1

Thanks for the contribution!
Could you maybe also integrate a remote mqtt configuration? I tried my luck here:
https://github.com/ppuetsch/homeassistant-vcontrol/tree/main

However, I wasn't able to (sucessfully) test it as during my test still the main docker images (without the changes to the run scripts) were used. I right now don't have the time to dig deeper into that - but If you like the changes, maybe you can integrate them into your PR.

Thank you :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
it's about the docker image pull policy. To test locally, simply comment out the image-line so it gets re-created upon installation:
https://github.com/Schm1tz1/homeassistant-vcontrol/blob/remote-vcontrold/vcontrold/config.yaml#L70

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, it's about the docker image pull policy. To test locally, simply comment out the image-line so it gets re-created upon installation: https://github.com/Schm1tz1/homeassistant-vcontrol/blob/remote-vcontrold/vcontrold/config.yaml#L70

Thank you! 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Alexandre-io - took a look at the suggested changes and also the suggestions made by @ppuetsch. I think if we let the end-user switch by simply setting a different host/port or staying with the defaults we don't break anything, stay backwards-compatible and keep the configuration simple. To avoid restarts of the services due to non-existing vcontrold I needed to add a dummy tail-f service. Please have a look. It is already running in my basement :-)

roman and others added 2 commits January 24, 2023 14:32
…s suggested and only starting service in case we are using vcontrold@localhost, otherwise we are assuming a remote vcontrold
@Alexandre-io
Copy link
Owner

LGTM 👍 Clever solution, thanks guys!

@Alexandre-io Alexandre-io merged commit 1968352 into Alexandre-io:main Jan 24, 2023
@Schm1tz1 Schm1tz1 deleted the remote-vcontrold branch January 25, 2023 07:24
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

Successfully merging this pull request may close these issues.

None yet

3 participants