Skip to content

setIPAddress #112

@BobFrankston

Description

@BobFrankston

I started to add setIPaddress based on https://github.com/zranger1/HubitatWizLightDriver but I don't understand enough about this driver to debug it. For example, how the parent pointer works. Fortunately, the change seems simple so I can outline the essential parts here. I think this is all that is need but I can't be sure till I can actually get it work. I hope this helps.

In the Definitions

  command    "setIPAddress",["string"] 
  attribute  "macAddress","string"
  attribute  "ipAddress","string" 

In preferences

    input("ip", "text", title: "IP Address", description: "IP address of Wiz light", required: true)
    input name: "makerIPEnable", type: "bool", title: "Allow Maker API to set IP address", defaultValue: true
    

Add function

/ maker API can call this to set IP address, enabling mDNS
// resolution of bulb mac vs. address on remote system.
def setIPAddress(String addr) {
   if (makerIPEnable) {
       logDebug("setIPAdress(${addr})")   
       device.updateSetting("ip",addr);
       sendEvent([name: "ipAddress", value: addr])  
   }   
   else {
     logDebug("setIPAddress: request from Maker API denied.");
   }
}
private String myIp() {
   //  device.getDeviceNetworkId()
   return ip;
}

def getIPString() {
   return ip+":"+commandPort()
} 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions