void homegear_OnDeviceVariableUpdated(Homegear sender, Device device, Channel channel, Variable variable) { try { _logger.LogDebug("Update event received for variable {0} for device id {1} with value {2}.", variable.Name, device.TypeID, variable.BooleanValue); dynamic variableValue = ""; if (variable.StringValue != null && variable.StringValue != "") { variableValue = variable.StringValue; } else if (variable.DoubleValue != 0) { variableValue = variable.DoubleValue; } else if (variable.IntegerValue != 0) { variableValue = variable.IntegerValue; } _eventLoggerFactory.GetEventLoggerFor((HomegearDeviceTypes)device.TypeID, variable.Name).LogEvent(device.ID, variable.Name, variableValue); } catch (KeyNotFoundException exception) { _logger.LogDebug("No handler found for variable {0} with id {1}. Exception message: {1}", variable.Name, device.TypeID, exception.Message); } }