Use wc command to fetch the webcam state.#5
Open
anishsane wants to merge 1 commit intotasmota:mainfrom
Open
Conversation
The existing logic works overall.
However, it always expects the fields like WCResolution, WCFlip etc in
every stat/<topic>/RESULT mqtt message.
Thus, if we change any parameter (say brightness), then the other 4
parameters are missing in the corresponding RESULT message. Thus, we get
warnings like
```
WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'WCMirror' when rendering '{{value_json.WCMirror}}'
WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'WCFlip' when rendering '{{value_json.WCFlip}}'
WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'WCResolution' when rendering '{{value_json.WCResolution}}'
WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'WCContrast' when rendering '{{value_json.WCContrast}}'
```
This unnecessarily floods the logs.
This change fixes it by using the wc command's output for parsing
instead of every individual command.
Instead of calling `wcresolution 10`, use `backlog _wcresolution 10; wc`
The leading _ for wcresolution skips the mqtt message for wcresolution.
And since all the operations call `wc` at the end, their result messages
contain the information for all 5 parameters used in this blueprint - mirror,
flip, resolution etc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The existing logic works overall.
However, it always expects the fields like WCResolution, WCFlip etc in every stat/$topic/RESULT mqtt message.
Thus, if we change any parameter (say brightness), then the other 4 parameters are missing in the corresponding RESULT message. Thus, we get warnings like
This unnecessarily floods the logs.
This change fixes it by using the wc command's output for parsing instead of every individual command.
Instead of calling
wcresolution 10, usebacklog _wcresolution 10; wc.The leading
_forwcresolutionskips the mqtt message for wcresolution output.Since all the operations now call
wcat the end, their result messages contain information for all 5 parameters used in this blueprint—mirror, flip, resolution, etc.