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

check for openhab environent and php support. #1290

Merged
merged 2 commits into from
Nov 19, 2022

Conversation

peuter
Copy link
Member

@peuter peuter commented Nov 5, 2022

This is a cherry-picked feature taken from a future changeset for the development branch. This is the minimum requirement to make the cometvisu work when its served by the openHAB server. The check is needed because some of the backend URLs are different in openHAB.

This is a cherry-picked feature taken from a future changeset
for the development branch. This is the minimum requirement
to make the cometvisu work when its served by the openHAB server.
The check is needed because some of the backend URLs
are different in openHAB.

Signed-off-by: Tobias Bräutigam <tbraeutigam@gmail.com>
const engine = cv.TemplateEngine.getInstance();
const clientBackend = engine.visu && typeof engine.visu.getBackend === 'function' ? engine.visu.getBackend() : {};
if (clientBackend.resources && clientBackend.resources.rest) {
path = clientBackend.resources.rest;
Copy link
Member

Choose a reason for hiding this comment

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

Is this code path only relevant for OpenHAB?
Or could it also be used by KNX, e.g. when served by the Docker container?

Copy link
Member Author

@peuter peuter Nov 6, 2022

Choose a reason for hiding this comment

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

This has always been a mix-up of two different things. The URL of the CometVisus REST-API has nothing to do with the backend used for state handling. e.g. you can use openHAB as "state-backend" and still have the normal PHP-REST-API (when you use the docker container). Only if you serve the CometVisu via openHABs own webserver, you use the REST-API that the cometvisu binding provides (same features as the PHP stuff, but natively implemented in java to make it work in openhab). And for that you need a slightly different URL. And thats what this is all about. So you only need to know if the CometVisu is served via openHAB.

@ChristianMayer
Copy link
Member

Opening the demo config with this PR included creates this error message on the console:
grafik

@ChristianMayer
Copy link
Member

Now I tried a plain release-0.12 branch without this PR - and it also shows this message.
But I didn't switch back to Qx 6 for that.

Could that be the cause of this message?

@peuter
Copy link
Member Author

peuter commented Nov 15, 2022

Could that be the cause of this message?

You never know, but I don't think so. I see the same request here, but it gets an answer and is working just fine. As the error show this is an server error (Status 500) you will find an error in you server logs that will describe the problem.
But it has nothing to do with this pull request.

@ChristianMayer ChristianMayer merged commit 101eef5 into CometVisu:release-0.12 Nov 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants