I used that chatgpt to see if it can write groovy…

I did this in the Bing Chat that is using current internet sources and it came up with this:

At the bottom you can see the sources of it's response.

I then asked if it could be made into a Hubitat application and got this:

Yes, it's possible to create a Hubitat application using Groovy that can flash your Hue lights with 4 different colors. You can use the code that I provided as a starting point and modify it to work with Hubitat.

Here's an example of how you can modify the code to work with Hubitat:

definition(
    name: "Flash Hue Lights",
    namespace: "your_namespace_here",
    author: "your_author_name_here",
    description: "Flashes Hue lights with 4 different colors.",
    category: "My Apps",
    iconUrl: "",
    iconX2Url: ""
)

preferences {
    section("Hue Bridge") {
        input "bridgeIp", "text", title: "IP Address", required: true
        input "bridgeUsername", "text", title: "Username", required: true
    }
}

def installed() {
    log.debug "Installed with settings: ${settings}"
}

def updated() {
    log.debug "Updated with settings: ${settings}"
}

def flashHueLights() {
    def hue = new HueBridge(bridgeIp, bridgeUsername)
    def lights = hue.getLights()
    def colors = ["red", "green", "blue", "yellow"]
    def delay = 500
    def count = 0
    while (count < 4) {
        lights.each { light ->
            light.setColor(colors[count])
            light.setOn(true)
        }
        sleep(delay)
        lights.each { light ->
            light.setOn(false)
        }
        count++
    }
}

def runInMinutes = { closure, minutes ->
    runIn(closure, minutes * 60)
}

runInMinutes(flashHueLights, 1)

This code defines a Hubitat application that flashes your Hue lights with 4 different colors. You can modify the bridgeIp and bridgeUsername variables in the preferences section to match your Hue bridge's IP address and username. The flashHueLights function is the same as before.

I hope this helps! Let me know if you have any other questions.

Source: Conversation with Bing, 3/31/2023(1) Hue Bridge Integration | Hubitat Documentation. Hue Bridge Integration | Hubitat Documentation Accessed 3/31/2023.
(2) hubitat/advanced-hue-light-sensor.groovy at master · apwelsh/hubitat. hubitat/hue/device/advanced-hue-light-sensor.groovy at master · apwelsh/hubitat · GitHub Accessed 3/31/2023.
(3) GitHub - HubitatCommunity/CoCoHue: Open-source community-created Hue .... GitHub - HubitatCommunity/CoCoHue: Open-source community-created Hue Bridge integration for Hubitat Accessed 3/31/2023.
(4) [Release] Advanced Hue Bridge Integration - Hubitat. [Release] Advanced Hue Bridge Integration Accessed 3/31/2023.
(5) Connect Phillips Hue to Hubitat - Tips - Hubitat. Connect Phillips Hue to Hubitat Accessed 3/31/2023.

1 Like