Skip to content

Use wc command to fetch the webcam state.#5

Open
anishsane wants to merge 1 commit intotasmota:mainfrom
anishsane:main
Open

Use wc command to fetch the webcam state.#5
anishsane wants to merge 1 commit intotasmota:mainfrom
anishsane:main

Conversation

@anishsane
Copy link
Copy Markdown
Contributor

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 output.
Since all the operations now call wc at the end, their result messages contain information for all 5 parameters used in this blueprint—mirror, flip, resolution, etc.

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.
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.

1 participant