ALLTERCO / shelly-script-examples

Shelly Scripts for Gen2 Shelly devices
Apache License 2.0
195 stars 55 forks source link

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

Open JensTimmerman opened 1 year ago

JensTimmerman commented 1 year ago

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?

eurich commented 1 year ago

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

JensTimmerman commented 1 year ago

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

WolfiFromFinland commented 12 months ago

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

JensTimmerman commented 11 months ago

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

JensTimmerman commented 11 months ago

@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
        );
});
WolfiFromFinland commented 11 months ago

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

taulfsime commented 5 months ago

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