Hobby

Connecting WiZ LED lights to Fibaro HC3

In popular DIY markets you can buy Philips WiZ LED light bulbs. They are affordable choice over Hue lights. WiZ lights operate thru WiFi connection and can be integrated easily within OpenHAB system as a wizlighting binding coming from marketplace. However it is not a case in Fibaro HC3 where there is no direct integration. However… you can create your own QuickApp application and insert custom Lua code to communicate over UDP with those LED bulbs.

To get status of a bulb (a.b.c.d is a IPv4 address):

echo '{"method":"getPilot","params":{}}' | nc -u -w 1 a.b.c.d 38899

To turn on the light:

{"id":1,"method":"setState","params":{"state":true}}

To turn off the light:

{"id":1,"method":"setState","params":{"state":false}}

And here we have QuickApp lua code:

function QuickApp:turnOn()
    self:debug("binary switch turned on")
    self:updateProperty("value", true)

    local data = '{ "id":1,"method":"setState","params":{"state":true} }'
    local socket = net.UDPSocket()
    socket:sendTo(data, "a.b.c.d", 38899, {
        success = function()
            self:debug(data)
        end, 
        error = function(error)
            print('Error:', error)
        end    
    })
end

function QuickApp:turnOff()
    self:debug("binary switch turned off")
    self:updateProperty("value", false)   

    local data = '{ "id":1,"method":"setState","params":{"state":false} }'
    local socket = net.UDPSocket()
    socket:sendTo(data, "a.b.c.d", 38899, {
        success = function()
            self:debug(data)
        end, 
        error = function(error)
            print('Error:', error)
        end    
    }) 
end

function QuickApp:onInit()
    self:debug("onInit")
end

To create QuickApp application, go to Settings – Devices – Add – Other – QuickApp.

Further reading https://aleksandr.rogozin.us/blog/2021/8/13/hacking-philips-wiz-lights-via-command-line