Option to display some data from the query instead of match/no match image
Hi @mjbnz,
thank you very much for your plugin. It is the most flexible requests plugins for SD and the one that really embraces the SD spirit (actions and info). I was looking for something very similar but was hopping to use some data from the query as information to display on the key instead of just an image.
Would it be okay if I try to prepare a PR with this change ? Or would it not fit the vision your have for your plugin (and I should just fork it) ?
Based on the UI you have implemented, I think I would add a checkbox next to the "Set button image based on response" (i.e. "Return some data from response") and would present a similar field to determine what to search in the data. Then on the code-side, I would try to plug it cleanly to the fetch call (like all the other option do) and do some additional code to either prepare the text and display it through a setTitle() or prepare the text and render it as image (like some other plugin do).
Hi @Commit-La-Grenouille , in principle, yes, that sounds like a great feature. I'll happily look at a PR if you want to put one together.
Cool feature. Worth merging IMO
Hi @Commit-La-Grenouille, with version 6.5.0 of the stream deck software data from responce doesn't work. Can you fix it, please?
Hi MaxeoN,
This is weird as I applied the 6.5.0 update on my work laptop and I did not notice a regression on the few keys running the API request plugin. Have you checked your authentication token in case it lapsed coincidentally at the same time? Or can you see anything helpful in the plugin's logs (see this page for finding the logs: https://docs.elgato.com/sdk/plugins/events-sent#logmessage) ?
I will try to test on my personal laptop this week to see if I can reproduce the success or the problem ;)
Le 24 déc. 2023, 06:18, à 06:18, MaxeoN @.***> a écrit:
Hi @Commit-La-Grenouille, with version 6.5.0 of the stream deck software data from responce doesn't work. Can you fix it, please?
-- Reply to this email directly or view it on GitHub: https://github.com/mjbnz/streamdeck-api-request/issues/3#issuecomment-1868435381 You are receiving this because you were mentioned.
Message ID: @.***>
Thank's for your feedback @Commit-La-Grenouille. There is no any log file created by the plugin in the specified folder "%appdata%\Elgato\StreamDeck\logs". Should i turn it on somwhere in the plugin script? I have found the problem, it's all about backgroung image. That should be set anyway or title won't show anything. Is that possible to add more than one string? For e.g. i have a device that can send me temperature, humidity and pressure. I want to add all of these strings to the button. Is that realizable?
Thanks MaxeoN for sharing the details of your test. As long as the JSON returns the capabilities list in this order, your JSON path seems fine.
However, I got a gotcha moment after breakfast thinking about your problem as I remembered that there is 2 distinct paths in the configuration: the matching path for success/failure and the one for the display. Is this JSON path in the display config and supposed to display true/false (or along some fixed text)?
When I get some better internet and few minutes, I will try to find a public service I can use to do something similar to reproduce (or not) ;)
Le 25 déc. 2023, 12:32, à 12:32, MaxeoN @.***> a écrit:
Thank's for your feedback @Commit-La-Grenouille. There is no any log file created by the plugin in the specified folder "%appdata%\Elgato\StreamDeck\logs". Should i turn it on somwhere in the plugin script? I have checked authentication token, it's OK. I can run my script in request body section successfully, my target server accepts command and send the answer. I got green success indicator each time i press the button. The smart plug device, that is connected to the server, reacts accordinly to the script, but nothing happens in title field. Maybe my JSON path is incorrect. JSON Path: capabilities[1].state.value I try to parse it from the answer below. I'm interested in the device state (true\false) : { "status": "ok", "request_id": "c131eebc-38e1-458a-baab-f11dfa5bd0c9", "id": "48ffeb2a-1c43-4057-982f-74baecec02c9", "name": "lamp", "aliases": [], "type": "devices.types.light", "external_id": "bf42ddf3989ff7162dbcy3", "skill_id": "2b43bda8-d721-42a6-bf54-9e1e771093c2", "state": "online", "groups": [], "room": "e1fc2acf-7afc-4cc5-b9b6-df89ebdd7e03", "capabilities": [ { "retrievable": true, "type": "devices.capabilities.color_setting", "parameters": { "color_model": "hsv", "temperature_k": { "min": 2700, "max": 6500 } }, "state": { "instance": "hsv", "value": { "h": 1, "s": 100, "v": 100 } }, "last_updated": 1703350062.829439 }, { "retrievable": true, "type": "devices.capabilities.on_off", "parameters": { "split": false }, "state": { "instance": "on", "value": false }, "last_updated": 1703439305.301481 }, { "retrievable": true, "type": "devices.capabilities.range", "parameters": { "instance": "brightness", "unit": "unit.percent", "random_access": true, "looped": false, "range": { "min": 1, "max": 100, "precision": 11 } }, "state": { "instance": "brightness", "value": 100 }, "last_updated": 1681996056.2182252 }, { "retrievable": false, "type": "devices.capabilities.mode", "parameters": { "instance": "thermostat", "modes": [ { "value": "heat" }, { "value": "cool" }, { "value": "auto" }, { "value": "dry" }, { "value": "fan_only" }, { "value": "preheat" } ] }, "state": null, "last_updated": 0.0 } ], "properties": [] }
-- Reply to this email directly or view it on GitHub: https://github.com/mjbnz/streamdeck-api-request/issues/3#issuecomment-1868941016 You are receiving this because you were mentioned.
Message ID: @.***>
I have found the problem, it's all about backgroung image. That should be set anyway or title won't show anything. Is that possible to add more than one string? For e.g. i have a device that can send me temperature, humidity and pressure. I want to add all of these strings to the button. Is that realizable?
Hi MaxeoN,
Glad to hear you found the glitch. This thread is about decoupling background and content display (TBD).
For the multi-data usage, I will let the plugin author comment but if the doc does not mention anything, it may be worth a dedicated issue. When I will be able to spend some time in the code, I should be able to comment on how complex it will be ;)
Le 26 déc. 2023, 09:47, à 09:47, MaxeoN @.***> a écrit:
I have found the problem, it's all about backgroung image. That should be set anyway or title won't show anything. Is that possible to add more than one string? For e.g. i have a device that can send me temperature, humidity and pressure. I want to add all of these strings to the button. Is that realizable?
-- Reply to this email directly or view it on GitHub: https://github.com/mjbnz/streamdeck-api-request/issues/3#issuecomment-1869374575 You are receiving this because you were mentioned.
Message ID: @.***>