Integrating ShellyPlug smart plug using customapi. How are query params listed in the services(dot)yaml file? #4758
-
DescriptionI've been building my homepage and wanted to integrate my Shelly Plug smart plug into it, in order to display the power draw of my server. Shelly Plug comes with a cloud api service to use. ![]() The ShellyPlus documentation lists the following curl command: I entered this command from inside my homepage container, and it produced a JSON response from the api, which means the two can communicate. The problem seems to be entering the correct information into the services.yaml file to receive the data. How does the widget send the API request? I sent the POST request using Insomnia with my id and auth_key value as "Form URL encoded" body requests, and got the correct response. I just don't know how to correctly input this in the services file. See: ![]() The key field I want is the power draw, which is provided in the JSON data as "apower". Any help greatly appreciated. homepage versionv0.10.9 Installation methodDocker Configurationservices.yaml
- ShellyPlug:
icon:
href: https://control.shelly.cloud
description: Dell Optiplex
siteMonitor: https://control.shelly.cloud
statusStyle: dot
widget:
type: customapi
url: https://shelly-160-eu.shelly.cloud/device/status
refreshInterval: 5000 # optional - in milliseconds, defaults to 10s
method: POST # optional, e.g. POST
headers:
requestBody:
id: REDACTED
auth_key: REDACTED
display: # optional, default to block, see below
mappings:
- field:
label: Power Draw
format: number
suffix: W Container LogsNo response Browser LogsNo response Troubleshooting/app # curl -X POST https://shelly-160-eu.shelly.cloud/device/status -d "id=REDACTED&auth_key=REDACTED" |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Solved. I needed to pass through the Content-Type headers. So my services.yaml now looks like this:
|
Beta Was this translation helpful? Give feedback.
-
This discussion has been automatically closed because it was marked as answered. See our contributing guidelines for more details. |
Beta Was this translation helpful? Give feedback.
Solved. I needed to pass through the Content-Type headers. So my services.yaml now looks like this: