Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Not issue) Information how to switch On/Off photoframe from domoticz #162

Open
JuliAn50M opened this issue Jun 28, 2020 · 0 comments
Open

Comments

@JuliAn50M
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant