Start a new topic

Change settings over local API

Is there a way or is it planned that we can change settings like screensaver on/off over the local API?


Hi,


this is possible (although not officially documented). I just implemented it into https://github.com/alexrockt/lmnotify - for now you can only toggle the screensaver. I'll add changing the mode and setting a start and end time later.


If you only need a curl request, I can show you an example.

I already wrote my own php scripts to access LaMetric from my home web server. Honestly I have no idea about python so a curl example would be highly appreciated. :)

Sure, no problem:


Turn screensaver on:


curl -k -i -H "Authorization: Basic AUTH_TOKEN" https://IP_ADDRESS/api/v1/screensaver -d '{"widget":"WIDGET_ID_OF_SCREENSAVER", "enabled":true,"modes":{"when_dark":{"enabled":true},"time_based":{"start_time":"20:20:48","enabled":false,"end_time":"04:20:53"}}}' -X PUT -H "Content-Type: application/json"


Turn off:


curl -k -i -H "Authorization: Basic AUTH_TOKEN" https://IP_ADDRESS/api/v1/screensaver -d '{"widget":"WIDGET_ID_OF_SCREENSAVER", "enabled":false,"modes":{"when_dark":{"enabled":true},"time_based":{"start_time":"20:20:48","enabled":false,"end_time":"04:20:53"}}}' -X PUT -H "Content-Type: application/json"


You can also change the start/end_time and which mode to enable/disable


WIDGET_ID_OF_SCREENSAVER is returned when you call the /api/v2/device/display endpoint


Thanks

Weird, when I try to call the URL (in my case http://10.0.1.8:8080/api/v1/screensaver) it tells me resource not found

Make sure to use "https" instead of "http" and port 80, not 8080

Login or Signup to post a comment