We have moved at community.getvera.com

Author Topic: Vera Plus Sets Zigbee Dimmers Light Level to 0 on OFF Breaks Manual Switch  (Read 641 times)

Offline KhoaTon

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
I have Zigbee GE/Jasco dimmer switches that are connected (and supported for use with) Vera Plus.

Using the Vera Plus local web site to turn on/off dim the light works.  The problem seems to be that if I turn off the light via the web interface, Vera Plus seems to do this by setting the light level to 0%.  Now when I use the wall switch to turn on the light, it is turned on, but at 0% light level, which is the the wrong response.  The expected response would be like using the web interface to turn the switch on, which brings the light level to the previous dim setting.

I'm new to the home automation and Zigbee area, but it seems like Vera Plus is doing:
  OFF:Zigbee.setLevel(0)
  ON: Zigbee.setLevel(OldLightLevel)
when it should be doing:
  OFF: Zigbee.off()
  ON: Zigbee.on()

The result is that right after a switch off by Vera, the manual on switch seems like it's no longer working.  This seems like major usability problem for a dimmer wall switch that I wonder if it's just my setup?  If so, can anyone tell me how I can fix it?

Thank you in advance.

EDIT:
Here is the verbose log:

10   12/15/17 4:09:03.797   mg_callback from IP:127.0.0.1:39913 /port_3480/data_request id=lu_action&output_format=json&DeviceNum=7&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&rand=0.7238745864800287 start id: 283 <0x742c4520>
12   12/15/17 4:09:03.797   luvd_get_info_data_request starting /data_request?id=lu_action&output_format=json&DeviceNum=7&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&rand=0.7238745864800287 pMem 0x16f4000/24068096 diff: 8597504 <0x742c4520>
10   12/15/17 4:09:03.798   JobHandler_LuaUPnP::HandleRequest id lu_action request pMem 0x16f4000/24068096 diff: 8597504 <0x742c4520>
10   12/15/17 4:09:03.798   sbrk JobHandler_LuaUPnP::HandleActionRequest from IP:95.187.51.90 pMem 0x16f4000/24068096 diff: 8597504 <0x742c4520>
08   12/15/17 4:09:03.799   JobHandler_LuaUPnP::HandleActionRequest device: 7 service: urn:upnp-org:serviceId:SwitchPower1 action: SetTarget <0x742c4520>
08   12/15/17 4:09:03.799   JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=7 <0x742c4520>
08   12/15/17 4:09:03.799   JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:upnp-org:serviceId:SwitchPower1 <0x742c4520>
08   12/15/17 4:09:03.799   JobHandler_LuaUPnP::HandleActionRequest argument action=SetTarget <0x742c4520>
08   12/15/17 4:09:03.799   JobHandler_LuaUPnP::HandleActionRequest argument newTargetValue=0 <0x742c4520>
08   12/15/17 4:09:03.799   JobHandler_LuaUPnP::HandleActionRequest argument rand=0.7238745864800287 <0x742c4520>
35   12/15/17 4:09:03.800   JobHandler_LuaUPnP::ConfirmGlobalActionRules start <0x742c4520>
10   12/15/17 4:09:03.800   ZigbeeNode::ReceivedMessage 0x3e97 (7) : new UPnP Action <0x742c4520>
10   12/15/17 4:09:03.800      ZigbeeNode::ReceivedMessage 0x3e97 (7) Service:  urn:upnp-org:serviceId:SwitchPower1 <0x742c4520>
10   12/15/17 4:09:03.800      ZigbeeNode::ReceivedMessage 0x3e97 (7) Action: SetTarget <0x742c4520>
01   12/15/17 4:09:03.800   ZigbeeNode::ReceivedMessage 0x3e97 (7) : No newLoadLevelTarget, testing if there is a newTargetValue <0x742c4520>
10   12/15/17 4:09:03.801   Zigbee::PollRequest_Node 0x3e97 (7) LEVEL ACTION: 0 <0x742c4520>
35   12/15/17 4:09:03.801   ZigbeeNode::SetVariable <0x742c4520>
35   12/15/17 4:09:03.801   ZigbeeNode::SetVariable 0x3e97 (7) Setting: Service: urn:upnp-org:serviceId:Dimming1, Variable: LoadLevelTarget = 0 <0x742c4520>
06   12/15/17 4:09:03.801   Device_Variable::m_szValue_set device: 7 service: urn:upnp-org:serviceId:Dimming1 variable: LoadLevelTarget was: 100 now: 0 #hooks: 0 upnp: 0 skip: 0 v:0x10382d0/NONE duplicate:0 <0x742c4520>
10   12/15/17 4:09:03.801   UserData::m_iDataVersion_Variables_incr LoadLevelTarget user data 339637002 variables 339637368 <0x742c4520>
10   12/15/17 4:09:03.802   UserData::DataIsDirty UpdateStateList was 1 incr 0 user data 339637002 variables 339637368 <0x742c4520>
10   12/15/17 4:09:03.802   AlarmManager::AddRelativeAlarm current time 1513339743 delay 0 type 45 <0x742c4520>
10   12/15/17 4:09:03.802   AlarmManager::AddAbsoluteAlarm alarm 0xec3bf0 entry 0x1059c30 id 158 type 45 param=(nil) entry->when: 1513339743 time: 1513339743 bCancelFirst 0=0 <0x742c4520>
31   12/15/17 4:09:03.803   AlarmManager::Run 0xec3bf0 notified of a change entry 0xefbc60 id 59 deleted 0 <0x76cc4520>
31   12/15/17 4:09:03.803   AlarmManager::Run 0xec3bf0 notified of a change entry 0xededb8 id 138 deleted 0 <0x76ac4520>
31   12/15/17 4:09:03.804   AlarmManager::Run callback for alarm 0xec3bf0 entry 0x1059c30 type 45 id 158 param=(nil) entry->when: 1513339743 time: 1513339743 tnum: 1 slow 0 tardy 0 <0x76ac4520>
31   12/15/17 4:09:03.804   AlarmManager::Run finish callback for alarm 0xec3bf0 entry 0x1059c30 type 45 id 158 param=(nil) entry->when: 1513339743 time: 1513339743 tnum: 1 slow 0 duration 0 <0x76ac4520>
35   12/15/17 4:09:03.803   ZigbeeNode::SetVariable <0x742c4520>
35   12/15/17 4:09:03.806   ZigbeeNode::SetVariable 0x3e97 (7) Setting: Service: urn:upnp-org:serviceId:SwitchPower1, Variable: Target = 0 <0x742c4520>
06   12/15/17 4:09:03.807   Device_Variable::m_szValue_set device: 7 service: urn:upnp-org:serviceId:SwitchPower1 variable: Target was: 1 now: 0 #hooks: 0 upnp: 0 skip: 0 v:0x1036b68/NONE duplicate:0 <0x742c4520>
10   12/15/17 4:09:03.807   UserData::m_iDataVersion_Variables_incr Target user data 339637002 variables 339637369 <0x742c4520>
10   12/15/17 4:09:03.814   luvd_get_info_data_request creating file buffer /data_request?id=status2&LoadTime=1513339637&DataVersion=339637367&Timeout=40&MinimumDelay=0 pMem 0x16f4000/24068096 diff: 8597504 <0x73ac4520>
10   12/15/17 4:09:03.814   luvd_get_info_data_request done /data_request?id=status2&LoadTime=1513339637&DataVersion=339637367&Timeout=40&MinimumDelay=0 ret 0 size 750 pMem 0x16f4000/24068096 diff: 8597504 took 0 info (nil) <0x73ac4520>
10   12/15/17 4:09:03.815   mg_callback /data_request stop id: 283 <0x73ac4520>


Not knowing the code, I'm guessing that the ZigbeeNode object in the Vera Plus firmware is setting dimming level to 0.  The dimming level should not be set on a switch turn off request!  I can't think of a way to work around this bug even with Luup code in a scene triggered off of device switch off... After a good night sleep, found workaround, see below.

I am running the current latest Vera Plus firmware:  "You are running the latest version 1.7.3232"

MORE EDIT [12/15/17]
Found workaround using scenes:
When the switch for a dimmer is turned to ON, change light dimming level to the old dimming level.
This will trigger when the switch is manually flipped on the wall, getting the light out of 0% dimming.
I'll post the Luup code here when I finish testing it...

I'm finding that I will have to add this scene change to all my dimmers until Vera Plus firmware stops setting light level to 0% on switch OFF.
« Last Edit: December 16, 2017, 02:29:07 am by KhoaTon »

Offline KhoaTon

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: Vera Plus Sets Zigbee Dimmers Light Level to 0 on OFF Breaks Manual Switch
« Reply #1 on: December 16, 2017, 09:32:43 am »
A quick writeup on this issue, and a cleaner workaround than use of scenes.

PROBLEM:
GE/Jasco Zigbee dimmer switches will act like it won't turn back on when physically pressed ON after Vera Plus turns it OFF.

CAUSE:
Vera Plus code to turn off Zigbee dimmer switches will force the dimming level to 0%.  When this switch is turned on by Vera Plus, Vera Plus will set dimming level to its original correct non-zero value.  However, when the switch is physically pressed on, Vera Plus isn't triggered to do anything, so switch is turned on with 0% dim level, thus no light and switch looks like it's defective.  User will need to depress switch ON and hold to increase light level (change dimming) to get light at the physical switch.

SUGGESTED SOLUTION:
Vera Plus firmware should remove code in Zigbee driver that sets dimming level (LoadLevelTarget) to 0 when it's requested to turn off switch (SetTarget to 0).  When switch is physically turned on, the dimming level is still correctly non-zero, and Vera Plus doesn't have to do anything for correct switch functionality.

WORKAROUND:
Add triggers to explicity set dimming (LoadLevelTarget) to the correct non-zero value (LoadLevelLast) when switch is turned on.  This trigger takes effect when the switch is physically turned on in addition to being turned on by Vera Plus.  This workaround will no longer be needed when Vera Plus firmware implements the suggested solution.

CODE:
Put this code in Vera Plus's Startup Lua:
Code: [Select]
-- Workaround for Vera Plus firmware setting LoadLevelTarget (dimming level) to 0 when setting Target (on/off) to 0 (OFF)
-- way down in the Zigbee driver level.  This caused problem when the light is switched on at the wall switch, it goes on
-- at 0% light level.  The workaround is to explicitly set the LoadLevelTarget back to its old LoadLevelLast dim value
-- every time the light goes back on.  This is done via a trigger on light status below.
-- This workaround will no longer be necessary when the Vera Plus firmware fixes its dimming to zero bug on light off.
-- KTT [171216]
function dimmer_status_changed(device, service, variable, value_old, value_new)
  luup.log("KTT: dimmer_status_changed(" .. device .. ", " .. service .. ", " .. variable .. ", " .. value_old .. ", " .. value_new .. ") called.")
  if (service == "urn:upnp-org:serviceId:SwitchPower1") and (variable == "Status") and (value_new == "1") then
    -- We may need to fixup this device
    luup.log("KTT: Device powered ON")
    local loadLevelStatus = luup.variable_get("urn:upnp-org:serviceId:Dimming1", "LoadLevelStatus", device)
    local loadLevelLast = luup.variable_get("urn:upnp-org:serviceId:Dimming1", "LoadLevelLast", device)
    if loadLevelStatus == "0" then
      -- We need to fix up this dimmer
      luup.log("KTT: Fixing up this device!")
      luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = loadLevelLast}, device)
    end
  end
end

-- Add triggers to watch for state change on dimmer switches
for deviceNo,d in pairs(luup.devices) do
  if (d.id ~= "") and (d.device_type == "urn:schemas-upnp-org:device:DimmableLight:1") then
    -- Set trigger on these devices to run fixup when turned on
    luup.variable_watch("dimmer_status_changed", "urn:upnp-org:serviceId:SwitchPower1","Status", deviceNo)
  end
end



Offline bogdanf

  • Steering Box Fanclub
  • Administrator
  • Full Member
  • *****
  • Posts: 235
  • Karma: +8/-1
  • Did you change the oil ?
Issue resolved in 7.0.26 software update.