Object Model Values - MintyTrebor/BtnCmd GitHub Wiki

When Posting HTTP requests, or sending MQTT messages it is possible to include the value of Object Model Variables in the data sent.

BtnCmd will look for specially formatted string in the data and replace it with a value from the Object Model.

Scenario: Send current printer state to MQTT from BtnCmd Button

In the MQTT Msg field of the MQTT Button settings - enter:
The Printer is currently #omv[state.status]
When the button is clicked, BtnCmd will replace #omv[state.status] with the current value of state.status, so assuming the printer is idle then message that gets sent via MQTT will read:
The Printer is currently idle

Scenario: Send current printer state as HTTP post data from BtnCmd Button

In the Post Data field of the HTTP Post Button settings - enter:
{"state": "#omv[state.status]"}
When the button is clicked, BtnCmd will replace #omv[state.status] with the current value of state.status, so assuming the printer is idle then data that gets sent via HTTP will read:
{"state": "idle"}
Note: HTTP Post data must be in JSON format. A warning will appear if your post data does not follow the JSON formatting requirements.

Any value from the object model can be included, and more than one value can be included by repeating the #omv[xxxxx.xxxx] syntax.

Note : Not all model values are available all the time. If you input a bad path or the path is not currently found in the model you will see ### instead of the value. Model paths that follow a format of xxxxxx[#].xxxxxx eg heat.heaters[0].current, may have to be altered to xxxxxx.#.xxxxxx eg heat.heaters.0.current to work correctly