photoframe
photoframe copied to clipboard
(Not issue) Information how to switch On/Off photoframe from domoticz
My photoframe is set to wake up 1 hour a day. This is cool. But sometimes when I'm at home (in week end for exemple) I want to switch on the frame. If like me you have a domotic, you can drive it via http request (via curl for exemple in domoticz).
you need two requests:
-One to disable the schedule (Powersave = none) so it switch On: curl -X PUT -H "Authorization: Basic cGhvdG9mcmFtZTpwYXNzd29yZA==" http://192.168.0.40:7777/setting/powersave/none
-One to re-establish the schedule (Powersave = schedule) so it switch Off if you are out of range time : curl -X PUT -H "Authorization: Basic cGhvdG9mcmFtZTpwYXNzd29yZA==" http://192.168.0.40:7777/setting/powersave/schedule
There are two things to change in requests:
- 'cGhvdG9mcmFtZTpwYXNzd29yZA==' is your encoded credential
- '192.168.0.40:7777 ' is photoframe IP:Port
to get this informations, I use Fiddler to watch request sent to photoframe when you are log on the settings interface.
In domoticz, create a Selector switch with 2 levels ( ON - OFF - ID=194 in my case).
Then create this LUA script (replace your selector id)
=> function getNameFromIdx(deviceIDX) for i, v in pairs(otherdevices_idx) do if v == deviceIDX then return i end end return 0 end commandArray = {}
--Constantes
myDeviceIdx = 194
myDeviceName = getNameFromIdx(myDeviceIdx)
-- loop through all the changed devices
for deviceName,deviceValue in pairs(devicechanged) do
--isolation conso lave linge
if (deviceName==myDeviceName) then
if deviceValue == "ON" then
print("PhotoFrame is ON")
os.execute ('curl -X PUT -H "Authorization: Basic cGhvdG9mcmFtZTpwYXNzd29yZA==" http://192.168.0.40:7777/setting/powersave/none')
else
print("PhotoFrame is OFF")
os.execute ('curl -X PUT -H "Authorization: Basic cGhvdG9mcmFtZTpwYXNzd29yZA==" http://192.168.0.40:7777/setting/powersave/schedule')
end
end
end return commandArray