DaveGut / HubitatActive

Hubitat Environment Developments
64 stars 87 forks source link

LED device status fix rev2 #14

Closed Jon8RFC closed 3 years ago

Jon8RFC commented 3 years ago

This revision supersedes #13. These code changes correct the LED status problem by actually querying the LED status and adjusting the attribute appropriately. The device LED status displayed on Hubitat now functions correctly, despite the number of successive clicks.

  1. update version
  2. check LED system status when LED commands are sent
  3. correct logDebug typo regarding LED changes
  4. remove erroneous sendEvent(name: "led", value: "on")
  5. add LED attribute to change based on LED system status
  6. add LED debug log based on LED system status
  7. change LED error response to log if failed and set LED attribute to appropriately notify user
  8. correct logWarn typo regarding LED changes

Item 4 isn't in every driver file, but it's in many of them. For example: https://github.com/DaveGut/HubitatActive/blob/8fa64a30e97d5310faa27e3a58933ff824f7b454/KasaDevices/DeviceDrivers/Plug-Switch.groovy#L809

DaveGut commented 3 years ago

I will update the code in a week or two: Commands: Agree with your adding getSysInfo distResp: Will remove: "} else if (response.system.set_led_off.err_code != 0) {' and below. setSysInfo: Will use: def ledOnOff = "on" if (status.led_off == 1) { ledOnOff = "off" } if (ledOnOff != device.currentValue("led")) { sendEvent(name: "led", value: ledOnOff) logInfo("setSysInfo: Led On/Off = ${ledOnOff}") }

Thanks for the heads-up.

DaveGut commented 3 years ago

Version 6.3.3 of the drivers and app have been updated on GitHub and linked to Hubitat Package Manager (HPM). These changes reflect the issues discussed in your changes.

Thank you very much for raising the issue and providing a solution.

Dave