-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
JSONSchema for the frigate.yaml? #2421
Comments
This is why we migrated the config parser to Pydantic, but I don't think the endpoint that exposes the JSON schema was created yet. |
Looks like this was added https://github.com/blakeblackshear/frigate/blob/master/frigate/http.py#L337 so this issue can probably be closed now? |
I wonder if it's gonna work with the vs code add-on. An example on how to configure it would be nice. |
It seems you could do just add |
If that works then the docs can be updated to reflect that |
It worked! :D I used: |
Closing this as it is now fully released |
For some reason my VScode no longer connects:
I am however able to open the webinterface and can read the config JSON at http://homeassistant:5000/api/config. Is something changed or is there something wrong with my setup? |
Yes the address changed https://docs.frigate.video/configuration/#vscode-configuration-schema |
@printplaatreparatie I have the same issue. It does not work while I'm able to fetch the file using curl. |
Getting the same issue: "Unabled to load schema..." |
Doesn't work for me either. |
That is incorrect, you should check the latest docs |
You should use an IP, vscode maybe not support loading from a hostname like that |
I've tried it with the IP address as well, unfortunately without success. (Again, I was able to reach the page from within my browser.) |
Can you post the full url you were able to reach? |
Where is VS Code running? Is it through the add-on? |
If it's through the vscode add-on, you should put: # yaml-language-server: $schema=http://ccab4aaf-frigate:5000/api/config/schema.json |
Config is shared by samba, and opened by Vscode on my laptop. This is the url when using the direct ip adress (which I would like to avoid, and which also not works): |
It was supposed to work indeed. Are you using some kind of remote access in your vscode, like a devcontainer or ssh target? Make sure such environment can also reach the API. You can try curl it from there. |
No, I have a script that mounts the config folder and opens VScode. For VScode it should be the same as opening a local file. To be sure, I copied the file to the Desktop folder and opened it from there. The problem persists. I can also curl the link from my VScode terminal without any problem. Edit: My OS is Kubuntu 22.04 Edit 2: I'm using the homeassistant validator for the other files with this configuration:
This will change the "language" of the frigate config file to Home Assistant. Switching to standard yaml doesn't make a difference though. |
I think it's important that the frigate file does not get interpreted as home-assistant, because the hass extension would enforce its own schemas otherwise. How about you create a new vscode profile, empty, just with the YAML extension and try again? |
The test that I did with the file in the Desktop folder was with an empty profile. Still no bueno. |
Well, try any other schema, like this one:
If it doesn't work, then the problem is somewhere else. Maybe in the YAML extension. |
Actually, I was wrong about the profile. My default profile uses the home assistant language. Hold on, this might be the problem. |
Okay, this is a bit embarrassing.. The YAML extension was not installed on my machine. The problem only became visible when I enabled the Home Assistant config helper last year. I think I removed the yaml extension, presuming the HA extension would do the job, which it will not. Now the yaml extension is installed the error went away and I'm able to use the schema, even with the Home Assistant helper enabled. Thanks for helping me out! |
I can't even curl from within an ssh session of HA itself
For my case: frigate is running as an addon. I'm assuming I can't find the json because I'm hitting HA and not frigate. |
Alright, was able to hit it from within HA by using |
I get the confusion and made PR #9709 to make the documentation more concise. Edit: New PR to master branch |
I am also trying to use the schema for validation, and my use case is with the embedded editor on the Frigate web interface. I have added the line to the top of the file using IP and hostname (resolves within frigate container, not using add-on). I cannot get it to work, so I wondered if this is because of the embedded editor not having the YAML extension, and it seems like it is. I am able to get validation working and the schema recognized when using desktop VS Code. Is it possible to get the YAML extenstion bundled with Frigate? I realize that maybe the license won't allow this, but not sure. If not it surely isn't a very big deal, and I can use a remote connection in VS Code to edit instead. Thanks for all the info provided in this thread, I had wondered why it "wasn't working" for a while, but hadn't looked into it and with tips provided was able to figure it out! |
Describe what you are trying to accomplish and why in non technical terms
I use the VS Code add-on on Hassio to edit the
frigate.yaml
. But oftenly I have to go back and forth to the documentation and try to restart the Frigate server to find out if I messed up with it or not.Describe the solution you'd like
With a JSON Schema, we could leverage VS Code's YAML validation almost for free, by just configuring it to use it, or by adding this in the top of the YAML file:
Describe alternatives you've considered
Going back and forward to the Frigate docs and restarting it as mentioned.
Additional context
Not exactly the point here, but there are also tools which can create documentation in markdown format which can be used with Docusaurus based on the JSON Schema, so that you don't have to maintain the documentation in two different places. Only in the JSON Schema.
The text was updated successfully, but these errors were encountered: