Open JensTimmerman opened 1 year ago
just check https://github.com/shelly-tools/shelly-script-examples, there are various examples how to control HuE Bulbs ..
@eurich Where can I find the our scripts or webhooks created specifically for Shelly Plus i4.
that are referenced in the marketing materials?
@JensTimmerman did you find some scripts about the Shelly Plus i4? I am also struggling with scripting...
@WolfiFromFinland I wrote some myself, but I'm still looking for the scripts that are promised here in the marketing copy
@WolfiFromFinland I created this simple script to switch the lights states in hue bridge, can be expanded upon, I need to add some timing code to check for double/tripple taps and holds of the buttons
// CONFIG START
let CONFIG = {
ip: '192.168.1.XX', //Hue Bridge IP
user: 'XXX-XXX', //Hue Bridge API token/user get this by following https://developers.meethue.com/develop/get-started-2/
lights: {'0': '37', '1': '36', '2': '32', '3': '33'}, // mapping from button to Hue Light ID to control
};
// CONFIG END
Shelly.addStatusHandler(function (e) {
print(e)
light = CONFIG.lights[e.delta.id]
if (light == 'undefined' || ! e.delta.state ) {
return // only proceed on press of a button
}
Shelly.call(
"http.request", {
method: "GET",
url: 'http://' + CONFIG.ip + '/api/' + CONFIG.user + '/lights/' + light, // get current light state from hue
},
function (res, error_code, error_message, ud) {
let st = JSON.parse(res.body);
Shelly.call("http.request", {
method: "PUT",
url: 'http://' + CONFIG.ip + '/api/' + CONFIG.user + '/lights/' + light + '/state',
body: '{"on": ' + !st.state.on + '}' // toggle light state
},
function (r, e, m) {},null);
},
null
);
});
Thanks a lot @JensTimmerman - very helpful! I got a few ideas on how to continue.
@WolfiFromFinland Hello, did you success with the script? Do you need any help?
If its ready could you open a PR with all sensitive info wiped out so everyone who is looking for such an example, can use it?
The shell i4 plus order page states:
And then the learn more link directs me here, however I can not seem to find the scrips or web hooks that are created specifically for the shelly plus i4 that can control my Philips hue bridge?