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

Allow set preset and fix go to preset #520

Merged
merged 7 commits into from
Nov 5, 2022

Conversation

duhow
Copy link
Contributor

@duhow duhow commented Oct 30, 2022

Since the set_preset function is currently implemented in ipc_cmd, I'm adding it to the Web-UI.

  • Fix Web-UI "Goto Preset" not working
  • Add Web-UI "Set Preset" button + API POST /preset.sh
  • Add Home Assistant (MQTT) Camera Preset (not persistent)

@duhow
Copy link
Contributor Author

duhow commented Oct 30, 2022

Still need to test locally before merging.... Fighting with compile process.

@duhow duhow marked this pull request as draft October 30, 2022 10:04
@duhow
Copy link
Contributor Author

duhow commented Oct 30, 2022

web tested!

@duhow duhow marked this pull request as ready for review October 30, 2022 11:09
@roleoroleo
Copy link
Owner

The preset implementation contained in ipc_cmd is not complete.
Because there are some problems:

  • you can add a preset but only in the first unused position (8 positions available), you can't choose the index where to save it;
  • you can't remove a preset at the moment (but it's possible adding a new command in ipc_cmd);
  • you can't see the list of saved presets;
  • the preview is available only inside the app, we should add a sort of label to identify the preset.

Do you think it's enough to make the feature usable?

@roleoroleo
Copy link
Owner

I will merge this pr and I will add the missing part (mainly ipc_cmd).
Thank you for your code.

@roleoroleo roleoroleo merged commit b47aebf into roleoroleo:master Nov 5, 2022
@roleoroleo
Copy link
Owner

Do you want to update mqtt part after my last commits?
94ec021
69d947f

@duhow
Copy link
Contributor Author

duhow commented Nov 6, 2022

Sorry for the delay,

For what I tested I thought this was overriding the "last selected preset", but it appears to be appending to last preset as you mention.

Having labels for presets might need to have Yi-Hack to store and manage the preset references, so I'd leave that up to you on how to better handle it.

Sure, I can provide the changes for MQTT :)

@duhow duhow deleted the set-preset branch November 6, 2022 17:35
@roleoroleo
Copy link
Owner

The IPC command to add a preset doesn't accept arguments about where to store the preset.
Simply it checks if there is a free position (starting from index 0) and stores the the preset.
The IPC command to delete a preset accepts "index" argument. And when you delete a preset the other presets are not reordered, the gap remains.

Having labels for presets might need to have Yi-Hack to store and manage the preset references, so I'd leave that up to you on how to better handle it.

This is the hard part. The app stores a snapshot of the preset so you can recognize it. The hack cannot read the snapshot because it's not stored in the cam (I think).
And it's hard to read the preset storage because the struct depends on the cam model (y21ga, h51ga, etc...)

So, this is my thought:

  • The preset editing must be done only with the hack. If you edit them from the app, hack and app will lose synchronism. You can use presets with the app but not add/delete.
  • How to recognize presets? I think a label is enough, but it's stored in a different file: the preset is stored in the yi original struct using IPC commands, the label is stored in a file.

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.

2 participants