shelly-script-examples icon indicating copy to clipboard operation
shelly-script-examples copied to clipboard

Unable to find scripts/webhooks to control Philips Hue with shelly i4 plus

Open JensTimmerman opened this issue 2 years ago • 8 comments

The shell i4 plus order page states:

Whether you use Shelly Wi-Fi bulbs, Philips Hue, or even different brands smart bulbs, Shelly Plus i4 is highly compatible and can control them all!

 

Furthermore, you can use Shelly Plus i4 to set the light color you want or for dimming of your smart bulbs. All you have to do is add and configure one of our scripts or webhooks created specifically for Shelly Plus i4.

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?

JensTimmerman avatar Jul 09 '23 17:07 JensTimmerman

just check https://github.com/shelly-tools/shelly-script-examples, there are various examples how to control HuE Bulbs ..

eurich avatar Aug 05 '23 03:08 eurich

@eurich Where can I find the our scripts or webhooks created specifically for Shelly Plus i4. that are referenced in the marketing materials?

JensTimmerman avatar Aug 05 '23 22:08 JensTimmerman

@JensTimmerman did you find some scripts about the Shelly Plus i4? I am also struggling with scripting...

WolfiFromFinland avatar Oct 23 '23 08:10 WolfiFromFinland

@WolfiFromFinland I wrote some myself, but I'm still looking for the scripts that are promised here in the marketing copy

JensTimmerman avatar Nov 06 '23 16:11 JensTimmerman

@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
        );
});

JensTimmerman avatar Nov 07 '23 08:11 JensTimmerman

Thanks a lot @JensTimmerman - very helpful! I got a few ideas on how to continue.

WolfiFromFinland avatar Nov 10 '23 14:11 WolfiFromFinland

@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?

taulfsime avatar May 04 '24 16:05 taulfsime