Hi @nayelyz
device:refresh() method put in a function to handle it in a subdriver or the main driver Zwave (Z-Wave Switch stock and others) causes the driver to enter an infinite loop until the driver is reset
local function device_refresh( self, device)
device:refresh()
end
local fibaro_double_switch = {
NAME = "fibaro double switch",
capability_handlers = {
[capabilities.refresh.ID] = {
[capabilities.refresh.commands.refresh.NAME] = device_refresh,
}
},
Loop Logs after refresh command until driver reinitialize it self
2022-09-30T19:12:29.773944967+00:00 TRACE Z-Wave Switch and Child Mc Found CapabilityCommandDispatcher handler in zwave_switch
2022-09-30T19:12:29.799463301+00:00 TRACE Z-Wave Switch and Child Mc Found CapabilityCommandDispatcher handler in zwave_switch
2022-09-30T19:12:29.865944967+00:00 TRACE Z-Wave Switch and Child Mc Found CapabilityCommandDispatcher handler in zwave_switch
2022-09-30T19:12:29.892842634+00:00 TRACE Z-Wave Switch and Child Mc Found CapabilityCommandDispatcher handler in zwave_switch
2022-09-30T19:12:29.949766634+00:00 TRACE Z-Wave Switch and Child Mc Found CapabilityCommandDispatcher handler in zwave_switch
2022-09-30T19:12:30.021680967+00:00 TRACE Z-Wave Switch and Child Mc Found CapabilityCommandDispatcher handler in zwave_switch
2022-09-30T19:12:30.132494967+00:00 TRACE Z-Wave Switch and Child Mc Found CapabilityCommandDispatcher handler in zwave_switch
2022-09-30T19:12:30.769417301+00:00 TRACE Z-Wave Switch and Child Mc Found CapabilityCommandDispatcher handler in zwave_switch
2022-09-30T19:12:31.297622968+00:00 TRACE Z-Wave Switch and Child Mc Found CapabilityCommandDispatcher handler in zwave_switch
2022-09-30T19:12:31.420268635+00:00 TRACE Z-Wave Switch and Child Mc Found CapabilityCommandDispatcher handler in zwave_switch
2022-09-30T19:12:31.507650301+00:00 TRACE Z-Wave Switch and Child Mc Found CapabilityCommandDispatcher handler in zwave_switch
2022-09-30T19:12:31.610564968+00:00 TRACE Z-Wave Switch and Child Mc Found CapabilityCommandDispatcher handler in zwave_switch
2022-09-30T19:12:41.137265639+00:00 TRACE Z-Wave Switch and Child Mc Setup driver zwave_switch with lifecycle handlers:
DeviceLifecycleDispatcher: zwave_switch
default_handlers:
added:
removed:
infoChanged:
driverSwitched:
doConfigure:
init:
child_dispatchers:
DeviceLifecycleDispatcher: zwave_switch â eaton accessory dimmer
default_handlers:
child_dispatchers:
DeviceLifecycleDispatcher: zwave_switch â Inovelli LED
default_handlers:
child_dispatchers:
DeviceLifecycleDispatcher: zwave_switch â inovelli dimmer
default_handlers:
child_dispatchers:
DeviceLifecycleDispatcher: zwave_switch â Dawon smart plug
default_handlers:
child_dispatchers:
DeviceLifecycleDispatcher: zwave_switch â Inovelli 2 channel smart plug
default_handlers:
init:
doConfigure:
child_dispatchers:
DeviceLifecycleDispatcher: zwave_switch â zwave dual switch
default_handlers:
added:
child_dispatchers:
DeviceLifecycleDispatcher: zwave_switch â zwave dual switch â fibaro walli double switch
default_handlers:
init:
child_dispatchers:
With Z-wave Switch stock with device:refresh() in subdriver âfibaro-double-switchâ
Tihis log is after driver self reinitialized and to perform added lifecycle added, that contains device:refresh()
2022-09-30T19:10:32.915238004+00:00 TRACE Z-Wave Switch Z-Wave Device: bd5c15c7-76f5-4430-b95d-c8ea349e9f61
Manufacturer: 0x010F Product Type: 0x0203 Product ID: 0x1000
[0]: SWITCH_MULTILEVEL, SWITCH_BINARY, DEVICE_RESET_LOCALLY, ASSOCIATION, CONFIGURATION, MULTI_CHANNEL_ASSOCIATION, MULTI_CHANNEL, PROTECTION, CENTRAL_SCENE, ZWAVEPLUS_INFO, VERSION, MANUFACTURER_SPECIFIC, ASSOCIATION_GRP_INFO, POWERLEVEL, APPLICATION_STATUS, CRC_16_ENCAP, METER, NOTIFICATION, SECURITY, FIRMWARE_UPDATE_MD [1]: SWITCH_MULTILEVEL, SWITCH_BINARY, DEVICE_RESET_LOCALLY, ASSOCIATION, CONFIGURATION, MULTI_CHANNEL_ASSOCIATION, MULTI_CHANNEL, PROTECTION, CENTRAL_SCENE, ZWAVEPLUS_INFO, VERSION, MANUFACTURER_SPECIFIC, ASSOCIATION_GRP_INFO, POWERLEVEL, APPLICATION_STATUS, CRC_16_ENCAP, METER, NOTIFICATION, SECURITY, FIRMWARE_UPDATE_MD
2022-09-30T19:10:32.930331004+00:00 TRACE Z-Wave Switch Received event with handler _resync
2022-09-30T19:10:32.939160004+00:00 TRACE Z-Wave Switch Received event with handler environment_info
2022-09-30T19:10:32.982978338+00:00 TRACE Z-Wave Switch Found DeviceLifecycleDispatcher handler in zwave_switch â fibaro double switch
2022-09-30T19:10:32.989219338+00:00 DEBUG Z-Wave Switch Luz Entrada device thread event handled
2022-09-30T19:10:32.999226671+00:00 TRACE Z-Wave Switch Received event with handler environment_info
2022-09-30T19:10:33.004994004+00:00 DEBUG Z-Wave Switch Z-Wave hub node ID environment changed.
2022-09-30T19:10:33.027262338+00:00 TRACE Z-Wave Switch Received event with handler device_lifecycle
2022-09-30T19:10:33.039204671+00:00 INFO Z-Wave Switch <ZwaveDevice: bd5c15c7-76f5-4430-b95d-c8ea349e9f61 [1E] (Luz Entrada)> received lifecycle event: added
2022-09-30T19:10:33.065859004+00:00 TRACE Z-Wave Switch Found DeviceLifecycleDispatcher handler in zwave_switch
2022-09-30T19:10:33.077784004+00:00 TRACE Z-Wave Switch Found CapabilityCommandDispatcher handler in zwave_switch â fibaro double switch
2022-09-30T19:10:33.089521338+00:00 TRACE Z-Wave Switch Found CapabilityCommandDispatcher handler in zwave_switch â fibaro double switch
2022-09-30T19:10:33.101314671+00:00 TRACE Z-Wave Switch Found CapabilityCommandDispatcher handler in zwave_switch â fibaro double switch
2022-09-30T19:10:33.192578338+00:00 TRACE Z-Wave Switch Found CapabilityCommandDispatcher handler in zwave_switch â fibaro double switch
2022-09-30T19:10:33.236287671+00:00 TRACE Z-Wave Switch Found CapabilityCommandDispatcher handler in zwave_switch â fibaro double switch
2022-09-30T19:10:33.264326338+00:00 TRACE Z-Wave Switch Found CapabilityCommandDispatcher handler in zwave_switch â fibaro double switch
2022-09-30T19:10:33.279162671+00:00 TRACE Z-Wave Switch Found CapabilityCommandDispatcher handler in zwave_switch â fibaro double switch2022-09-30T19:10:32.915238004+00:00 TRACE Z-Wave Switch Z-Wave Device: bd5c15c7-76f5-4430-b95d-c8ea349e9f61
Manufacturer: 0x010F Product Type: 0x0203 Product ID: 0x1000
[0]: SWITCH_MULTILEVEL, SWITCH_BINARY, DEVICE_RESET_LOCALLY, ASSOCIATION, CONFIGURATION, MULTI_CHANNEL_ASSOCIATION, MULTI_CHANNEL, PROTECTION, CENTRAL_SCENE, ZWAVEPLUS_INFO, VERSION, MANUFACTURER_SPECIFIC, ASSOCIATION_GRP_INFO, POWERLEVEL, APPLICATION_STATUS, CRC_16_ENCAP, METER, NOTIFICATION, SECURITY, FIRMWARE_UPDATE_MD [1]: SWITCH_MULTILEVEL, SWITCH_BINARY, DEVICE_RESET_LOCALLY, ASSOCIATION, CONFIGURATION, MULTI_CHANNEL_ASSOCIATION, MULTI_CHANNEL, PROTECTION, CENTRAL_SCENE, ZWAVEPLUS_INFO, VERSION, MANUFACTURER_SPECIFIC, ASSOCIATION_GRP_INFO, POWERLEVEL, APPLICATION_STATUS, CRC_16_ENCAP, METER, NOTIFICATION, SECURITY, FIRMWARE_UPDATE_MD
2022-09-30T19:10:32.930331004+00:00 TRACE Z-Wave Switch Received event with handler _resync
2022-09-30T19:10:32.939160004+00:00 TRACE Z-Wave Switch Received event with handler environment_info
2022-09-30T19:10:32.982978338+00:00 TRACE Z-Wave Switch Found DeviceLifecycleDispatcher handler in zwave_switch â fibaro double switch
2022-09-30T19:10:32.989219338+00:00 DEBUG Z-Wave Switch Luz Entrada device thread event handled
2022-09-30T19:10:32.999226671+00:00 TRACE Z-Wave Switch Received event with handler environment_info
2022-09-30T19:10:33.004994004+00:00 DEBUG Z-Wave Switch Z-Wave hub node ID environment changed.
2022-09-30T19:10:33.027262338+00:00 TRACE Z-Wave Switch Received event with handler device_lifecycle
2022-09-30T19:10:33.039204671+00:00 INFO Z-Wave Switch <ZwaveDevice: bd5c15c7-76f5-4430-b95d-c8ea349e9f61 [1E] (Luz Entrada)> received lifecycle event: added
2022-09-30T19:10:33.065859004+00:00 TRACE Z-Wave Switch Found DeviceLifecycleDispatcher handler in zwave_switch
2022-09-30T19:10:33.077784004+00:00 TRACE Z-Wave Switch Found CapabilityCommandDispatcher handler in zwave_switch â fibaro double switch
2022-09-30T19:10:33.089521338+00:00 TRACE Z-Wave Switch Found CapabilityCommandDispatcher handler in zwave_switch â fibaro double switch
2022-09-30T19:10:33.101314671+00:00 TRACE Z-Wave Switch Found CapabilityCommandDispatcher handler in zwave_switch â fibaro double switch
2022-09-30T19:10:33.192578338+00:00 TRACE Z-Wave Switch Found CapabilityCommandDispatcher handler in zwave_switch â fibaro double switch
2022-09-30T19:10:33.236287671+00:00 TRACE Z-Wave Switch Found CapabilityCommandDispatcher handler in zwave_switch â fibaro double switch
2022-09-30T19:10:33.264326338+00:00 TRACE Z-Wave Switch Found CapabilityCommandDispatcher handler in zwave_switch â fibaro double switch
2022-09-30T19:10:33.279162671+00:00 TRACE Z-Wave Switch Found CapabilityCommandDispatcher handler in zwave_switch â fibaro double switch
I have seen in several subdrivers that this method is not used directly and a GET command is used to obtain the status of each C.C.
The Z-Wave Switch stock and others have in main driver init.lua device:refresh() in the function that handles the lifecycle added. It works fine normally
local function device_added(driver, device)
device:refresh()
end
-------------------------------------------------------------------------------------------
-- Register message handlers and run driver
-------------------------------------------------------------------------------------------
local driver_template = {
supported_capabilities = {
capabilities.switch,
capabilities.switchLevel,
capabilities.battery,
capabilities.energyMeter,
capabilities.powerMeter,
capabilities.colorControl,
capabilities.button,
capabilities.temperatureMeasurement,
capabilities.relativeHumidityMeasurement
},
sub_drivers = {
require("eaton-accessory-dimmer"),
require("inovelli-LED"),
require("dawon-smart-plug"),
require("inovelli-2-channel-smart-plug"),
require("zwave-dual-switch"),
require("eaton-anyplace-switch"),
require("fibaro-wall-plug-us"),
require("dawon-wall-smart-switch"),
require("zooz-power-strip"),
require("aeon-smart-strip"),
require("qubino-switches"),
require("fibaro-double-switch"),
require("fibaro-single-switch"),
require("eaton-5-scene-keypad"),
require("ecolink-switch"),
require("zooz-zen-30-dimmer-relay")
},
lifecycle_handlers = {
init = device_init,
infoChanged = info_changed,
doConfigure = do_configure,
added = device_added
}
Can device:refresh() be used to handle Refresh capability command manually on Z-Wave drivers as used in Zigbee without problems?